Advertisement
xeromino

starfish

Aug 4th, 2015
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1. int num=5, movers=60, d3=50, frames=140;
  2. float angle, theta, d, d2;
  3. color bg=#202020;
  4.  
  5. void setup() {
  6.   size(540, 540, P2D);
  7.   smooth(5);
  8. }
  9.  
  10. void draw() {
  11.   randomSeed(455);
  12.   background(bg);
  13.   noFill();
  14.  
  15.   for (int i=0; i<num; i++) {
  16.     angle = TWO_PI/num*i;
  17.     d = map(sin(theta+angle*5), -1, 1, 150, 250);
  18.     float outerX = width/2 + cos(angle)*d;
  19.     float outerY = height/2+sin(angle)*d;
  20.     float cx1 = width/2 + cos(angle)*d*.8;
  21.     float cy1 = height/2+sin(angle)*d*.8;
  22.     d2 = map(sin(theta+angle), -1, 1, 20, 70);
  23.     for (int j=0; j<movers; j++) {
  24.       float offSet = TWO_PI/movers*j;
  25.       float CmoverX = width/2+cos(theta+offSet)*d2;
  26.       float CmoverY = height/2+sin(theta+offSet)*d2;
  27.       CmoverY = abs(CmoverX);
  28.       float moverX = CmoverX + cos(angle+offSet)*d3;
  29.       float moverY = CmoverY + sin(angle)*d3;
  30.       float cx2 =  CmoverX + cos(angle)*d3;
  31.       float cy2 = CmoverY + sin(angle+offSet)*d3;
  32.       noFill();
  33.       stroke(#ffffff, 50);
  34.       bezier(outerX, outerY, cx1, cy1, cx2, cy2, moverX, moverY);
  35.     }
  36.   }
  37.   theta += TWO_PI/frames;
  38.  
  39.   if (frameCount<=frames) saveFrame("image-###.png");
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement