Advertisement
xeromino

heart

Nov 27th, 2013
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. color bg = #59071D;
  2. color str = #F2DDB6;
  3. int num = 70;
  4. Bow[] bows = new Bow[num];
  5.  
  6. void setup() {
  7. size(500, 500);
  8. background(bg);
  9. noFill();
  10. stroke(str,150);
  11. strokeWeight(2);
  12. float theta = 0;
  13. float y = 90;
  14.  
  15. for (int i=0; i<num; i++) {
  16. bows[i]= new Bow( y, theta);
  17. theta += TAU/num;
  18. y += ((height-120)/num);
  19. }
  20. }
  21.  
  22.  
  23. void draw() {
  24. background(bg);
  25. for (int i=0; i<bows.length; i++) {
  26. bows[i].display();
  27. }
  28.  
  29. // if (frameCount % 4 == 0 && frameCount<121) saveFrame("image-####.gif");
  30. }
  31.  
  32. class Bow {
  33. float diam, diam_x, theta, y, sw;
  34.  
  35. Bow(float _y, float _theta) {
  36. y = _y;
  37. theta = _theta;
  38. }
  39.  
  40. void display() {
  41. diam = map(cos(theta), -1, 1, 20, 150);
  42. diam_x = map(cos(theta), -1, 1, random(100,150), random(200,250));
  43. sw = 1;
  44. strokeWeight(sw);
  45. arc(width/2, y, diam_x, diam, PI, TAU);
  46. theta += 0.0523;
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement