Advertisement
xeromino

spaceOrange

Nov 12th, 2013
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1. color bg = #37324A;
  2. color f = #F3A358;
  3. color s = f;
  4. int steps = 50;
  5. int isteps = steps/2;
  6. float iRadius, org_x, org_y, theta;
  7. Circle[] innerCircles = new Circle[isteps];
  8.  
  9. void setup() {
  10.   size(500, 500);
  11.   background(bg);
  12.   rectMode(CENTER);
  13.  
  14.   org_x = width/2;
  15.   org_y = height/2;
  16.   theta = 0;
  17.  
  18.   iRadius = width/6;
  19.  
  20.  
  21.   for (int i=0; i < isteps; i++) {
  22.     int dir = -1;
  23.     innerCircles[i] = new Circle(theta, dir, iRadius);
  24.     theta += TAU/isteps;
  25.   }
  26. }
  27.  
  28. void draw() {
  29.   background(bg);
  30.  
  31.   for (int i=0; i<innerCircles.length; i++) {
  32.     innerCircles[i].run();
  33.   }
  34.  
  35.   //if (frameCount % 1 == 0 && frameCount < 19) saveFrame("image-####.gif");
  36. }
  37.  
  38. class Circle {
  39.   float x, y, sz, theta, theta2, radius;
  40.   int dir;
  41.  
  42.   Circle(float _theta, int _dir, float _radius) {
  43.     theta = _theta;
  44.     dir = _dir;
  45.     radius = _radius;
  46.   }
  47.  
  48.   void run() {
  49.     move();
  50.     display();
  51.   }
  52.  
  53.  
  54.   void move() {
  55.     x = org_x + sin(theta)*radius;
  56.     y = org_y + cos(theta)*radius;  
  57.     theta += 0.0523/4*dir;
  58.   }
  59.  
  60.   void display() {
  61.  
  62.     sz = 200;
  63.     noStroke();
  64.     fill(f, 30);
  65.  
  66.     ellipse(x, y, sz, sz);
  67.   }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement