Advertisement
xeromino

eclipse2

Aug 13th, 2014
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. float unit, theta;
  2. int num = 20;
  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, sqrt(sq(width/2)+sq(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. if (y>num/2) {
  22. arc(x*unit, y*unit, sz, sz, start, start+PI);
  23. } else {
  24. arc(x*unit, y*unit, sz, sz, 0, start+PI);
  25. }
  26. }
  27. }
  28. theta -= 0.0523;
  29. //if (frameCount%2==0 && frameCount<121) saveFrame("image-###.gif");
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement