Advertisement
xeromino

rose

Mar 15th, 2017
331
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. var slider, theta = 0;
  3. var frms = 120, counter = 100;
  4.  
  5. function setup() {
  6.     createCanvas(540,540);
  7.     slider = createSlider(1,10,4,0.1);
  8. }
  9.  
  10. function draw() {
  11.     background(34);
  12.     translate(width/2, height/2);
  13.    
  14.     k = slider.value();
  15.     k = 6.9;
  16.     beginShape();
  17.     noFill();
  18.     stroke(255);
  19.     strokeWeight(1.5);
  20.     for (var a=0; a<TWO_PI*k; a += 0.02) {
  21.         var r = map(sin(theta+a*4),-1,1,100,200) * cos(k*a);
  22.         var x = r * cos(a);
  23.         var y = r * sin(a);
  24.         vertex(x,y);
  25.     }
  26.     endShape();
  27.     theta += TWO_PI/frms;
  28.     if (frameCount<=frms) {
  29.         save("image-" + counter + ".png");
  30.         counter++;
  31.     }
  32. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement