Hey everyone, I'm a beginner to processing and i've made a little slideshow that I want implemented into another class.
- PImage[] images = new PImage[5];
- int counter; // Automatically initialized at 0
- final int DISPLAY_TIME = 10000;
- int lastTime; // When the current image was first displayed
- boolean cinematic = true;
- void setup()
- {
- size(880, 660);
- for (int i = 0; i < images.length; i++)
- {
- images[i] = loadImage("cine" + nf(i+1, 2) + ".jpg"); // nf() allows to generate 01, 02, etc.
- }
- lastTime = millis();
- }
- void draw()
- {
- background(255);
- fill(0);
- if (millis() - lastTime >= DISPLAY_TIME) // Time to display next image
- {
- counter = ++counter;
- if(counter == 5){
- cinematic = false;
- }
- lastTime = millis();
- }
- if(cinematic){
- image(images[counter], 0, 0);
- }
- }
Any help would be fantastic, thanks.
1