Sphere by Spiral
https://gyazo.com/76d346ebdd9b92732de3369194a92a7d
code:java
// Sphere by Spiral
import processing.opengl.*;
int radius = 100;
int num = 0;
void setup()
{
size(500, 300, OPENGL);
background(255);
stroke(0);
}
void draw()
{
background(255);
translate(width/2, height/2, 0);
rotateY(frameCount * 0.03);
rotateX(frameCount * 0.04);
float s = 0;
float t = 0;
float lastx = 0;
float lasty = 0;
float lastz = 0;
while (t < 180) {
s += 18;
t += 1;
float radianS = radians(s);
float radianT = radians(t);
float thisx = 0 + (radius * cos(radianS) * sin(radianT));
float thisy = 0 + (radius * sin(radianS) * sin(radianT));
float thisz = 0 + (radius * cos(radianT));
if (lastx != 0) {
line(thisx, thisy, thisz, lastx, lasty, lastz);
}
lastx = thisx;
lasty = thisy;
lastz = thisz;
}
if (num++ < 100 && num % 2 == 0) saveFrame("###.jpg");
}