xxxxxxxxxx
44
let r0 = 100; let r1 = 30;
let freq = 6;
let offset1 = 0; let rez = 5;
function setup(){
createCanvas(400, 400, WEBGL);
angleMode(DEGREES);
strokeWeight(1);
noFill();
}
function draw(){
background(0, 0, 100);
let x = map(mouseX, 0, width, 0, 360);
rotateX(30);
rotateY(60);
for(let sigma = 0; sigma < 360; sigma += 3){
stroke(255);
strokeWeight(1);
beginShape();
for(let phi = 0; phi < 360; phi += 10){
// let bump = (1+0.2*sin(phi*freq1)*sin(sigma*freq2));
let bump = 1+0.2*sin(phi*freq);
let x = (r0 + r1*bump * cos(phi + offset1)) * sin(sigma);
let y = r1*bump * sin(phi + offset1);
let z = (r0 + r1*bump * cos(phi + offset1)) * cos(sigma);
vertex(x, y, z);
// ellipse(x, z, 3, 3);
}
endShape();
}
offset1 += 1;
}