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