PDA

View Full Version : How to delay start of gif-animation


kippie
10-11-2002, 09:23 PM
Is it possible somehow to let a user determine when a gif-animation is started in a file. I only know that a gif-animation starts when the page in wich it is placed is loaded. But can it be done in an other way?

Kippie

bcbasslet
10-11-2002, 09:34 PM
well, here's an idea. you could do a rollover. Where the page loads with the first image...and when the user rolls over that image a second gif loads. That second gif could be an animated one. then when the mouse is moved off, the original image returns. The exact rollover code is in the javascript tutorials on javascriptkit.com...
Or..
you could just have a mouseclick on some specified place bring up a gif in another specified place on the page, and that gif just happens to be animated. 'Course might need an off switch to make the animgif go away...That code is in the tutorials too, under an article called something like "one click, two responses"
best i can do for you. I'm just a junior.

whammy
10-11-2002, 10:04 PM
You can also build the animated .gif to have the same image in the frame a whole bunch of times at the start (of course not appearing to animate while the same image is showing...).

Make sure if you do this, that you then compress the gif or that will make it huge. :)

RoyW
10-11-2002, 10:18 PM
See if this gives you some ideas
http://www.geocities.com/SiliconValley/Park/2554/animate.html

beetle
10-11-2002, 10:45 PM
Originally posted by whammy
You can also build the animated .gif to have the same image in the frame a whole bunch of times at the start (of course not appearing to animate while the same image is showing...).

Make sure if you do this, that you then compress the gif or that will make it huge. :) That's unecessary. With a halfway decent GIF editor, you can set the delay in tenth-of-a-second increments for each frame separately.

kippie...as bcbasslet and RoyW have pointed out...the only way you will accomplish this it with two GIFs. One animated, one not. There are no properties exposed to JS by animated GIFs that let you control their animation.

Note: Animated GIF's are, however, a run-time process of the browser. Find some animated GIFs on a webpage and hit your 'Stop' button and see what happens...

whammy
10-11-2002, 11:40 PM
Oh yeah, you're right, I forgot you could change the frame timing separately. It's been awhile since I made one. (Well over a year and a half) :)

That's what you should probably do.

kippie
10-12-2002, 12:24 AM
Thanks all of you.

Kippie

Mr J
10-12-2002, 01:48 PM
You could take a still image of the first frame of the animated gif


Have that load as the default

<img name=image1 src="pic_still.gif">

then run the proper gif after set time


<script>
setTimeout("image1.src='pic_ani.gif'",5000)
</script>

kippie
10-12-2002, 09:39 PM
Thanks Mr. J.

Kippie

redmeat
10-12-2002, 10:05 PM
Mr J idea is how'd I do it..... seems the most efficient way.