Advertisement
xeromino

Cubed sines

Oct 8th, 2013
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. float y, theta, rad;
  2. int num = 30;
  3. color bg= #000000;
  4.  
  5. void setup() {
  6.   size(500, 300);
  7.   background(bg);
  8.   noFill();
  9.   theta=0;
  10. }
  11.  
  12. void draw() {
  13.   background(0);
  14.   for (int i=0; i < num; i++) {
  15.     strokeWeight(random(20, 40));
  16.     rad = random(50, 60);
  17.     stroke((255/num)*i, 200);
  18.     float starty = height/2 + random(-10, 10);
  19.     beginShape();
  20.     for (int x=int(random(-3,3)); x< width; x++) {
  21.       y = starty+ (pow(sin(theta), 3)*rad);
  22.       curveVertex(x, y);
  23.       theta += .03;
  24.     }
  25.     endShape();
  26.   }
  27.  
  28.   if (frameCount > 100) saveFrame("line-###.gif");
  29. }
  30.  
  31. void mouseClicked() {
  32.   save(random(123) + ".jpg");
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement