Guest User

Untitled

a guest
May 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. float x, y;
  2. int i = 1;
  3. int dia = 1;
  4. int sph = 1;
  5.  
  6.  
  7. float angle = 0.0;
  8. float speed = 6.15;
  9. float orbit = 100;
  10.  
  11. void setup()
  12. {
  13. background(#666666);
  14. size(1280, 800);
  15. fill(#666666);
  16. stroke(#666666);
  17. strokeWeight( 2 );
  18. smooth();
  19. }
  20.  
  21. void draw()
  22. {
  23. frameRate( 30 );
  24.  
  25. if ( i % 2 == 0 )
  26. {
  27. fill(#b5f77c);
  28. } else if( i % 3 == 0 ) {
  29. fill(#7cb5f7);
  30. } else if( i % 5 == 0 ) {
  31. fill(#f77cb5);
  32. } else if( i % 7 == 0 ) {
  33. fill(#888888);
  34. }
  35.  
  36. orbit += 0.5;
  37. //speed += 0.00001;
  38. angle += speed % (width * height);
  39.  
  40. float sinval = sin(angle);
  41. float cosval = cos(angle);
  42.  
  43. x = ( -100 ) + (cosval * orbit);
  44. y = (height + 100) + (sinval * orbit);
  45.  
  46. dia %= 41;
  47. ellipse(x, y, dia, dia);
  48. dia++;
  49. i++;
  50. }
  51.  
  52. void keyPressed()
  53. {
  54. if(key == 's')
  55. {
  56. save("spiral.png");
  57. noLoop();
  58. }
  59. }
Add Comment
Please, Sign In to add comment