Advertisement
xeromino

craig

Feb 3rd, 2015
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. PImage img;
  2. float theta, setY;
  3. int frames = 35, py;
  4.  
  5. void setup() {
  6.   size(540, 540);
  7.   img=loadImage("craig.gif");
  8.   img.filter(INVERT);
  9. }
  10.  
  11. void draw() {
  12.   background(0);
  13.   stroke(230);
  14.   for (int x=0; x<width; x++) {
  15.     float offSet = map(x, 0, width, 0, PI);
  16.     float y = map(sin(theta+offSet*2), -1, 1, 0, 50);
  17.     setY=height-y-py;
  18.     line(x, height, x, setY );
  19.   }
  20.   blend(img,0,0,width, height,0,0,width, height,SUBTRACT);
  21.   println(frameCount, setY);
  22.   py+=5;
  23.   saveFrame("image-###.gif");
  24.   if (setY<-50) noLoop();
  25.   theta += TWO_PI/frames;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement