Advertisement
xeromino

example2

Oct 4th, 2014
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. float unit, theta;
  2. int num = 20, numFrames = 120;
  3.  
  4. void setup() {
  5.   size(500, 500);
  6.   unit = width/num;
  7.   noStroke();
  8. }
  9.  
  10. void draw() {
  11.   background(0);
  12.   for (int y=0; y<=num; y++) {
  13.     for (int x=0; x<=num; x++) {
  14.       float distance = dist(width/2, height/2, x*unit, y*unit);
  15.       float offSet = map(distance, 0, width/2+height/2, 0, TWO_PI);
  16.       float sz = map(sin(theta+offSet),-1,1,unit*.1,unit*.9);
  17.       float start = map(sin(theta+offSet),-1,1,0,PI);
  18.       float lerpAmount = map(distance, 0, width/2+height/2, 0,1);
  19.       color col = lerpColor(#FCE400, #C60C0C,  lerpAmount);
  20.       fill(col);
  21.       arc(x*unit, y*unit, sz, sz,start,start+PI);
  22.     }
  23.   }
  24.   theta += TWO_PI/numFrames;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement