Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : Transition between images

$
0
0
if you don't need to control the amount of fading and images are triggered by bang, this should do what you try to achieve :
click to change image. change the amount of tint(255, amount) to change the timing of the fading.
  1. PImage[] img= new PImage[25];
    int counter = 0;
    void setup()
    {
      size (400, 400);
      for (int i = 0; i<25; i++)
      {
        img[i] = loadImage(i+".jpg");
      }
    }
    void draw()
    {
      tint(255, 10);
      image(img[counter], 0, 0, width, height);
    }
    void mousePressed()
    {
      counter++;
      if (counter >img.length-1)
      {
        counter =0;
      }
    }

Viewing all articles
Browse latest Browse all 1768

Trending Articles