SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var x = 0;
  2. var y = 0;
  3.  
  4.  
  5. var ratio = (2 * 3.14159265358979323846264) / 26.57365292; // 2 * PI / valor aleatório(26.57365292): se for inteiro sem casas decimais, forma-se "sementes" em linha reta
  6. var theta = 0;
  7. var radius = 5;
  8. var ballDiam = 10;
  9. var step = false;
  10. var r = 0, g = 255;
  11.  
  12. var slider
  13.  
  14. function setup() {
  15.    
  16.     createCanvas(800, 800);
  17.     background(25);
  18. }
  19.  
  20.  
  21. function draw() {
  22.    
  23.     translate(width / 2, height / 2);
  24.  
  25.     x = radius * cos(theta);
  26.     y = radius * sin(theta);
  27.     theta = theta + ratio;
  28.  
  29.     if (theta > TWO_PI){
  30.         theta = theta - TWO_PI;
  31.         step += true;
  32.        
  33.     }
  34.    
  35.     if (step == true){
  36.         radius += ballDiam;
  37.         step = false;
  38.     }
  39.    
  40.     ellipse(x, y, ballDiam, ballDiam);
  41.     fill(r, g, 0);
  42.  
  43.     r += 0.78;
  44.  
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top