Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage img, img2;
- float theta, val=25;
- void setup() {
- img = loadImage("http://media-cache-ak0.pinimg.com/736x/29/61/6a/29616ab98f10a5363606f3c5970fd72f.jpg");
- img2 = loadImage("http://media-cache-ec0.pinimg.com/736x/3d/a1/13/3da1137e089fbf3b58ddd88393cd3eb9.jpg");
- size(500, 500);
- }
- void draw() {
- image(img, 0, 0);
- colorMode(HSB, 100);
- loadPixels();
- val = map(sin(theta),-1,1,10,50);
- for (int x=0; x<width; x++) {
- for (int y = 0; y<height; y++) {
- float b = brightness(img.get(x, y));
- if (b > 100-val) {
- int i = y*width+x;
- pixels[i] = img2.get(x, y);
- }
- }
- }
- updatePixels();
- theta += (PI/10);
- //if (theta < PI*1.05) saveFrame("image-###.gif");
- }
- void keyPressed() {
- saveFrame("image-####.gif");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement