Advertisement
xeromino

Tweaking around

Oct 10th, 2013
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. import processing.opengl.*;
  2. int radius = 120;
  3. void setup() {
  4.   size(500, 400, OPENGL);
  5.   background(255);
  6.  
  7. }
  8. void draw() {
  9.   stroke(171,13,13);
  10.   background(245,226,122);
  11.   translate(width/2, height/2, 0);
  12.   rotateY(frameCount * 0.01);
  13.   rotateX(frameCount * 0.02);
  14.   float s=0;
  15.   float t=0;
  16.   float lastx = 0;
  17.   float lasty = 0;
  18.   float lastz = 0;
  19.   while (t < 180) {
  20.     s+=119;
  21.     t+=1;
  22.     float radianS = radians(s);
  23.     float radianT = radians(t);
  24.     float thisx = 0 + (radius * cos(radianS) * sin(radianT));
  25.     float thisy = 0 + (radius * sin(radianS) * sin(radianT));
  26.     float thisz = 0 + (radius * cos(radianT));
  27.     if (lastx != 0) {
  28.       line(thisx, thisy, thisz, lastx, lasty, lastz);
  29.     }
  30.     lastx = thisx;
  31.     lasty = thisy;
  32.     lastz = thisz;
  33.   }
  34.  
  35.   //if (frameCount % 3 == 0) saveFrame("line-####.gif");
  36.   //if (frameCount > 181) noLoop();
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement