Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
make an animated gif with Processing
import gifAnimation.*;
GifMaker gifExport;
int frames = 0;
int totalFrames = 120;
public void setup() {
smooth();
size(400, 400);
gifExport = new GifMaker(this, "export.gif", 100);
gifExport.setRepeat(0); // make it an "endless" animation
noFill();
stroke(0);
strokeWeight(20);
}
void draw() {
background(255);
float size = 100.0 * sin(TWO_PI * frames / float(totalFrames)) + 200.0;
ellipse(width/ 2.0, height / 2.0, size, size);
export();
}
void export() {
if(frames < totalFrames) {
gifExport.setDelay(20);
gifExport.addFrame();
frames++;
} else {
gifExport.finish();
frames++;
println("gif saved");
exit();
}
}
@jordanorelli

This comment has been minimized.

Copy link
Owner Author

jordanorelli commented Apr 20, 2013

running this program will generate the following animated gif:

output

if that link breaks, it's here on my Tumblr

@anilsemizoglu

This comment has been minimized.

Copy link

anilsemizoglu commented May 6, 2015

very good demonstration for making gifs thank you.

@xespi

This comment has been minimized.

Copy link

xespi commented Jul 12, 2016

What a great example!!!
thanks so much

@simart

This comment has been minimized.

Copy link

simart commented Nov 23, 2017

Awesome! Thanks so much. Works great with 01010101's port for the current (3.X) version of Processing at https://github.com/01010101/GifAnimation.

@aradarbel10

This comment has been minimized.

Copy link

aradarbel10 commented Dec 24, 2017

Great! Working very good! You really helped me and my project ;D nice bro! =)

@C00dy

This comment has been minimized.

Copy link

C00dy commented Sep 19, 2018

Does anyone still have a current link to the library? The posted link is broken

@metype

This comment has been minimized.

@jordanorelli

This comment has been minimized.

Copy link
Owner Author

jordanorelli commented Jun 17, 2019

oh I didn't notice C00dy's comment at the time, must have had github notifications turned off. I updated the original tumblr post to include the link to the 3.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.