[Solved- Big thanks to MenteCode & GoToLoop] How to make gif file print randomly on screen?
in
Contributed Library Questions
•
6 months ago
Hi,
I am trying to make it so a gif file i made loops and randomly duplicates all over the screen, at the moment i have this very basic code that i have patched together which works for a small line that i tested:
import gifAnimation.*;
int y;
int num =14;
PImage[] animation;
Gif loopingGif;
Gif nonLoopingGif;
boolean pause = false;
public void setup() {
size(900, 800);
frameRate(100);
println("gifAnimation " + Gif.version());
// create the GifAnimation object for playback
loopingGif = new Gif(this, "gifstreisand.gif");
loopingGif.loop();
}
void draw() {
background(0);
image(loopingGif, 10, height / 2 - loopingGif.height / 2);
image(loopingGif, 60, height / 2 - loopingGif.height / 2);
image(loopingGif, 110, height / 2 - loopingGif.height / 2);
image(loopingGif, 160, height / 2 - loopingGif.height / 2);
image(loopingGif, 210, height / 2 - loopingGif.height / 2);
image(loopingGif, 260, height / 2 - loopingGif.height / 2);
image(loopingGif, 310, height / 2 - loopingGif.height / 2);
image(loopingGif, 360, height / 2 - loopingGif.height / 2);
image(loopingGif, 410, height / 2 - loopingGif.height / 2);
image(loopingGif, 460, height / 2 - loopingGif.height / 2);
}
Is there a more efficient way to do this?
I am very new at this and hope for some advice or support with this as it's important for my uni project development
Thank you in advance
1