xxxxxxxxxx
23
function setup() {
createCanvas(600, 400, WEBGL);
angleMode(DEGREES);
}
function draw() {
background('orange');
fill('lightblue');
stroke('black');
const panTilt = 20;
const spacing = 100;
rotateX(map(mouseY, 0, height - 1, panTilt, -panTilt));
rotateY(map(mouseX, 0, width - 1, -panTilt, panTilt));
for (let x = -spacing * 2; x <= spacing * 2; x += spacing) {
for (let z = -spacing * 50; z <= spacing * 3; z += spacing) {
push();
translate(x, 0, z);
torus(30, 10);
pop();
}
}
}