Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage img;
- int div=40, i=0, stepx, stepy;
- float theta;
- void setup() {
- img = loadImage("john.jpg");
- size(img.width, img.height);
- stepx = (int) width/div;
- frameRate(10);
- }
- void draw() {
- for (int x=0; x<width; x += stepx) {
- float offSet = PI/div*i;
- int h =(int) map(sin(theta+offSet), -1, 1, 0, height);
- int y =(int) map(sin(theta+offSet), -1, 1, 0, height);
- copy(img, x, height-y, stepx, y, x, 0, stepx, y);
- copy(img, x, 0, stepx, height-y, x, y, stepx, height-y);
- i++;
- }
- theta += (TWO_PI/30);
- //if (theta<TWO_PI) saveFrame("image-###.gif");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement