xxxxxxxxxx
34
let r = 200;
let total = 100;
let a = 0;
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
}
function rotation() {
rotateY(a);
a += 0.01;
}
function draw() {
background(0);
// rotation();
for (let i = 0; i < total; i++) {
let lat = map(i, 0, total, -HALF_PI, HALF_PI);
for (let j = 0; j < total; j++) {
let lon = map(j, 0, total, -TWO_PI, TWO_PI);
let x = r * sin(lon) * cos(lat);
let y = r * sin(lon) * sin(lat);
let z = r * cos(lon);
stroke(255);
strokeWeight(4);
point(x, y, z);
}
}
noLoop();
}