xxxxxxxxxx
41
let r1 = 100; let r2 = 50;
let angle = 0;
function setup() {
createCanvas(400, 400, WEBGL);
angleMode(DEGREES);
}
function draw() {
background(0, 0, 100);
orbitControl(1, 1);
noFill();
stroke(255);
beginShape(LINES);
let a = 1.5;
let b = 1;
for (let phi=0; phi<360; phi+=3) {
let x = (r1 + r2*cos(a*phi))*cos(b*phi);
let y = (r1 + r2*cos(a*phi))*sin(b*phi);
let z = r2*sin(a*phi);
vertex(x, y, z);
let x2 = (r1 + r2*cos(180 + a*phi))*cos(b*phi);
let y2 = (r1 + r2*cos(180 + a*phi))*sin(b*phi);
let z2 = r2*sin(180 + a*phi);
vertex(x2, y2, z2);
}
endShape();
angle +=1;
}