Advertisement
xeromino

infinity

Aug 25th, 2014
619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. int num=100;
  2. float step, maxDist, theta;
  3.  
  4.  
  5. void setup() {
  6. size(1000, 1000);
  7. rectMode(CENTER);
  8. noStroke();
  9. fill(255);
  10. step = width/num;
  11. maxDist = dist(0, 0, width/2, height/2);
  12. }
  13.  
  14. void draw() {
  15. background(#202020);
  16. for (int i=0; i<num; i++) {
  17. for (int j=0; j<num; j++) {
  18. pushMatrix();
  19. float x=step/2+i*step;
  20. float y=step/2+j*step;
  21. float distance = dist(x, y, width/2, height/2);
  22. float sz = map(distance, 0, maxDist, step*1,step*.15);
  23. float sc = map(sin(theta),-1,1,.5,2);
  24. float lerpAmount = map(distance, 0, maxDist, 0,1);
  25. color c = lerpColor(#E8F5AF ,#405A41 , lerpAmount);
  26. translate(x, y);
  27. fill(c);
  28. ellipse(0, 0, sz*sc,sz*sc);
  29. popMatrix();
  30. }
  31. }
  32. theta += 0.0523;
  33.  
  34. //if (frameCount%2==0 && frameCount<121) saveFrame("image-###.gif");
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement