- Make it interactive with the mouse, the further you move the mouse in one direction the more it explodes, or goes back to it’s original position
- Take an image and draw it with rectangles or circles with the proper colors
Hope you all get the reference (watch video with sound) Here is what I got using this code:
PImage dog;
float increment =4;
float incrementZ = 500;
void setup(){
size(700, 500, P3D);
dog = loadImage("C:/Users/mab1312/desktop/dog.jpg");
rectMode(CENTER);
}
void draw(){
noStroke();
background(0);
rotateY(.2);
for (int y = 0; y<dog.height; y+= increment){
for (int x = 0; x<dog.width; x+= increment){
dog.loadPixels();
int i = (x+y*dog.width);
color pix = dog.pixels[i];
fill(pix);
float d = map(brightness(pix),0,255,2,incrementZ/2);
pushMatrix();
translate(x,y,d);
box(increment, increment, map(mouseX, 0, width, 0, incrementZ));
popMatrix();
}
}
dog.updatePixels();
increment = map(mouseY,0,width,4,30);
}