We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › Animated GIF library for Processing
Pages: 1 2 
Animated GIF library for Processing (Read 16954 times)
Re: Animated GIF library for Processing
Reply #15 - Feb 3rd, 2009, 5:44pm
 
This library works perfectly for me. Awesome, thanks!

A side question... Does anyone know where I could find something like this for animated PNG instead of animated GIF?
Re: Animated GIF library for Processing
Reply #16 - Feb 3rd, 2009, 9:41pm
 
Animated PNG just doesn't exist...

That's not entirely true, because the creators of PNG designed the MNG (Multiple-image Network Graphics) format to handle animations. But this format is far from having the success/support of PNG: only some image viewers support it.
Re: Animated GIF library for Processing
Reply #17 - Feb 13th, 2009, 1:16pm
 
I have probmens with determining the image mode to center for the gif animation
imageMode(CENTER) doesn't work!

Please help!

greets, Carina
Re: Animated GIF library for Processing
Reply #18 - Feb 13th, 2009, 1:57pm
 
can you post some code?
Re: Animated GIF library for Processing
Reply #19 - Feb 13th, 2009, 2:05pm
 
import gifAnimation.*;

PImage bg;

Gif loopingGif1l;
Gif loopingGif1r;

float mouseAktuell;

public void setup() {
 size(698, 465, P3D);
   bg = loadImage("venedig_hintergrund.jpg");
  frameRate(30);

 // create the GifAnimation object for playback
 loopingGif1r = new Gif(this, "12.gif");
 loopingGif1r.loop();
 loopingGif1l = new Gif(this, "12gespiegelt.gif");
 loopingGif1l.loop();
}

void draw() {
 background(bg);
 mouseAktuell=mouseX;
}

void mouseMoved(){
 
 if(mouseX<mouseAktuell){
   image(loopingGif1r, mouseX, mouseY);
        mouseAktuell=mouseX;
 }

else{  
   image(loopingGif1l, mouseX, mouseY);
    mouseAktuell=mouseX;
}
}


_____


so if the mouse moves, the gif animation follows, but the gif is not in the center of the mouse, but in the corner.
normally i would have solved the problem with
image(loopingGif1r, mouseX, mouseY);
imageMode(Center);

but this doesn't seem to work with gifs Sad

thx, carina
Re: Animated GIF library for Processing
Reply #20 - Jun 9th, 2010, 5:22am
 
hej extrapixel, forum,

is there a way to set the general speed of the animation? would be amazing if there was a general delay setting that would affect every frame of the gif animation.

something like: Gif.speed(float percent);

thanks for the excellent library!! it is a lot of fun  Cheesy
best,
jacob
Re: Animated GIF library for Processing
Reply #21 - Jun 9th, 2010, 10:21am
 
ok, i've had some funny results when trying to make video renders of my GIF compositions....

since saveFrame() is pretty slow, i use Gif.pause(), then saveFrame(), then Gif.loop() again to make sure i get every frame of the animations down to disk. this works. but some of the frame delay of the gif animations gets eaten while saving, resulting in wrong (too fast) timing of the animations when i put the saved frames together to a movie.

im not a great programmer but i poked around the source code (Gif.java), and i think i have located the issue:
Code:
private int[] delays; 

contains the timing of each frame in the gif animation, and Code:
private int lastJumpTime; 

contains the last time a frame was progessed in the animation.
the pause command Code:
	public void pause() {
// System.out.println("pause");
play = false;
}
does not store the time it is paused, and the check Code:
if (parent.millis() - lastJumpTime >= delays[currentFrame]) { 

whether we need to jump to next frame does not take any time paused in to consideration.....

would it be possible to update the library to take pause timing into consideration?

or maybe make these variables public, so i could read them and update them myself in connection with every saveFrame() / pause?

best,
jacob
Re: Animated GIF library for Processing
Reply #22 - Jun 9th, 2010, 2:28pm
 
hello jacob,

unfortunately you deleted parts of your first post, where you described the actual problem (or wasn't i awake completely when i read it first time this morning?  Wink )

i think i understand what you want the library to do... but i don't think that's the way it should work (or, i still don't understand your question entirely).

in context of GIF a .speed() method doesn't make sense to me... (well it would be nice, but GIF doesn't know anything like that - and the gifAnimation-lib is a wrapper around gif.

if you want full control over the gif animation, just get all of the images using getPImages() and cycle through them however you want in your sketch. Like so you can make the animation dependent on your sketch framerate (or saveFrame-rate). other things to consider: use .jump() to go to a specific frame.

also, have you tried to render a "normal" sketch to a movie? i mean without any gifs in it. just to check if you understood the logic of saveFrame and it's connection to the sketch framerate...

or.. .just post some code to help me understand. (including your nice gif ani, of course  Cheesy )
Pages: 1 2