xxxxxxxxxx
48
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
angleMode(DEGREES);
}
let angle = 0;
let step = 90; // add 15 increments
let oscSpeed = 0.001; //angle velocity
function draw() {
background(220, 10);
// translate(width / 2, height / 2);
orbitControl();
noFill();
rotateX(90 * cos(angle));
let osc = 100 * cos(angle);
for (let a = 0; a < 20; a++) {
beginShape();
let r = a;
rotateZ(osc);
for (let i = 0; i < 361; i += step) {
let x = r * cos(i);
let y = r * sin(i);
let z = sin((angle += oscSpeed)) * osc;
strokeWeight(1);
stroke(0);
vertex(x * a, y * a, z * a);
push();
translate(x * a, y * a, z * a);
noStroke();
pointLight(255, 0, 0, 0, 0, 0);
pointLight(255, 0, 175, 0, 200, 0);
ambientMaterial(120);
sphere(a / 2);
pop();
}
angle += oscSpeed
endShape();
}
}