Loop animated .gif in python mode

Hello,

Is there a way to sequence all frames from an animated .gif (in a loop) in python mode?

I would like to run my .gifs without having to load each frame as a seperate file in the /data folder.

Thanks.

please format code with </> button * homework policy * asking questions

1 Like

YES!

2 Likes

Thank you villares,
This is exactly what I was seeking.

A note on the STEP 2 of the instruction above:

In order for the library to install correctly ensure you rename the unzipped Folder from /gif-animation-3.0 to /gifAnimation

I made a simple python example using the included “lavalamp.gif” file for anyone interested.

// JSGauthier
// Make a .gif loop using the gifAnimation library in python mode.

add_library('gifAnimation')

def setup():
    size(1000,1000)
    global G
    G = Gif(this, "lavalamp.gif")

def draw():
    background(0)
    G.loop()
    imageMode(CENTER)
    image(G, mouseX,mouseY)
1 Like