Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.opengl.*;
- int radius = 120;
- void setup() {
- size(500, 400, OPENGL);
- background(255);
- }
- void draw() {
- stroke(171,13,13);
- background(245,226,122);
- translate(width/2, height/2, 0);
- rotateY(frameCount * 0.01);
- rotateX(frameCount * 0.02);
- float s=0;
- float t=0;
- float lastx = 0;
- float lasty = 0;
- float lastz = 0;
- while (t < 180) {
- s+=119;
- 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 (frameCount % 3 == 0) saveFrame("line-####.gif");
- //if (frameCount > 181) noLoop();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement