Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage img;
- int bg = 0, ty=10, cols = 40;
- float x, sz;
- boolean on = true;
- void setup() {
- size(1000, 500);
- background(bg);
- img = loadImage("photo.jpg");
- frameRate(15);
- x = width/2;
- }
- void draw() {
- /*if (on) {
- img = loadImage("photo.jpg");
- } else {
- img = loadImage("photo2.jpg");
- }
- */
- rectMode(CENTER);
- color f = img.get(int(x-width/2), ty);
- float w = width/2/cols+random(-10, 10);
- float h = map(brightness(f), 0, 255, height*.1, height*.8);
- float a = map(brightness(f), 0, 255, 150, 35);
- fill(f, a);
- noStroke();
- rect(x, height/2, w, h, 5);
- x += w;
- if (x>width-10) {
- x=width/2;
- ty += (height*.1+random(-5, 5));
- if (ty>height) ty=0;
- }
- fill(bg);
- noStroke();
- //rectMode(CORNER);
- copy(img, 0, 0, 500, height, 0, 0, 500, height);
- stroke(255);
- noFill();
- ellipse(x-width/2, ty, 10, 10);
- if (frameCount%100==0) on =! on;
- }
- void mouseReleased() {
- saveFrame("image-###.jpg");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement