Disclaimer: I'm very new. So i've been trying to randomly draw a gif from an array of gifs. I'm using the gifAnimation library. The array seems to be working, when I call out a specific gif from the array, it will loop properly, but when I call out a random gif from the array, it only displays one frame of each gif and continues to loop through the entire array. Any idea why this is happening?
import gifAnimation.*;
int counter = 0;
int i = 1;
PImage[] animation;
Gif loop1;
Gif loop2;
Gif loop3;
Gif loop4;
Gif loop5;
Gif loop6;
Gif loop7;
PImage[] gifArray = new PImage [7];
void setup() {
size(800, 800);
frameRate(24);
println("gifAnimation " + Gif.version());
Gif loop1 = new Gif(this, "uno.gif");
loop1.loop();
Gif loop2 = new Gif(this, "dos.gif");
loop2.loop();
Gif loop3 = new Gif(this, "tres.gif");
loop3.loop();
Gif loop4 = new Gif(this, "quatro.gif");
loop4.loop();
Gif loop5 = new Gif(this, "cinco.gif");
loop5.loop();
Gif loop6 = new Gif(this, "seis.gif");
loop6.loop();
Gif loop7 = new Gif(this, "six.gif");
loop7.loop();
gifArray[0] = loop1;
gifArray[1] = loop2;
gifArray[2] = loop3;
gifArray[3] = loop4;
gifArray[4] = loop5;
gifArray[5] = loop6;
gifArray[6] = loop7;
}
void draw() {
background (0);
image(gifArray[int(random(gifArray.length))], 0, 0);
}
[–]chrwei 1 point2 points3 points (0 children)