fading a grid of images
in
Programming Questions
•
6 months ago
Hello I would like to make fades between a grid of images according to the position of the Mouse (as it shown in the code).
The idea would be to use 9 players image. How can I bind PImage to my player dynamically to make effects with tint for instance ? (the final purpose is to do it with shaders but I have to understand the way to refresh players in real time).
Thanks in advance.
the code shows one image per cell, although I would have wanted a fade effect with pictures around the cell.
The idea would be to use 9 players image. How can I bind PImage to my player dynamically to make effects with tint for instance ? (the final purpose is to do it with shaders but I have to understand the way to refresh players in real time).
Thanks in advance.
the code shows one image per cell, although I would have wanted a fade effect with pictures around the cell.
- PImage img[] = new PImage[25];
int video_nbr;
void setup()
{
size(800, 800);
textSize(20);
for (int k = 0; k<25; k++)
{
img[k] = loadImage(k+".jpg");
}
}
void draw()
{
background(150);
GUI();
displayIMAGE();
fill(255);
int coordX =constrain(int(5*mouseX/400), 0, 4);
int coordY= constrain(int(5*mouseY/400), 0, 4);
video_nbr = coordX +5*coordY;
text("X : "+ coordX +"\n"+ "Y : " + coordY +"\n"+ "Vidéos numéro= " +video_nbr, 20+width/2, 60);
}
void GUI()
{
for (int i= 0; i< 6; i++)
{
line(i*400/5, 0, i*400/5, 400);
line(0, i*400/5, 400, i*400/5);
}
fill(255, 90);
ellipse(constrain(mouseX, 0, 400), constrain(mouseY, 0, 400), 20, 20);
}
void displayIMAGE()
{
image(img[video_nbr], width/2, height/2, 200, 200);
}
1