Advertisement
xeromino

beziers

Dec 8th, 2013
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. color bg = #361826;
  2. color s = #ffffff;
  3. float x1, x2, x3, y1, y2, y3, theta;
  4.  
  5. void setup() {
  6.   size(500, 500);
  7.   background(bg);
  8.   noFill();
  9. }
  10.  
  11. void draw() {
  12.   background(bg);
  13.   stroke(s,200);
  14.  
  15.   for (int i=0; i<20; i++) {
  16.     strokeWeight(1);
  17.     beginShape();
  18.     vertex(0, i*20); // first point
  19.     x2 = map(sin(theta), -1, 1, 180+i*8, 250+i*6);
  20.     y2 = map(sin(theta), -1, 1, 150, 300);
  21.     x1 = x2*0.5;
  22.     y1 = (x2+y2)-x1;
  23.     x3 = x2*1.7;
  24.     y3 = (x2+y2)-x3;
  25.     bezierVertex(209, -3, x1, y1, x2, y2);
  26.     bezierVertex(x3, y3, 444, 419, 500-i*20, 500);
  27.     endShape();
  28.   }
  29.  
  30.   theta += 0.0523;
  31.  
  32.   if (frameCount % 5 == 0 && frameCount<121) saveFrame("image-####.gif");
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement