Javascript and animated gifs

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

Does anyone know if it's possible to control an animated gif using JS? Let's say to control the number of frames to be played or to control which frame has to be displayed?

I don't think it is, but hey, you'll never know Smiling

thanx,

Shakespeare: onclick || !(onclick)

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

I've never heard of anything like that being possible and I would be surprised if it was. Sounds like a job for flash Smiling

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

Hmmm, that was my thought about using flash. What exactly are you trying to do?

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

I am trying to make a mouseover using an animated gif with 2 or 3 frames. Mouseout: display frame 1, Mouseover display frame 2 etc...

I know there are other, better ways to do this, but for this particular case this way is the best since the animated gifs already exist. The total number of anigifs is 1,500 or so and I don't feel like splitting them all manually into two or three different gifs...

But it seems like I have to :/

anyone else?

Shakespeare: onclick || !(onclick)

Busy's picture

He has: 6,151 posts

Joined: May 2001

I remember someone made an animation using .jpg and javascript years ago. I'm not sure where it was now. I'll try my old bookmarks but I don't hold much hope of me keeping that one.

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

Busy, you probably mean something like this:
http://www.wpdfd.com/wpdanim.htm

Altough it's an interessting site, it doesn't help me solving my problem Sad

Thanx anyway. Anyone else?

Shakespeare: onclick || !(onclick)

They have: 9 posts

Joined: Oct 2002

I believe if you use Adobe Image Ready, you can create a rollover with multiple frames, and specify which frame shows up on each action.

I will try it out and let you know if it works.

Tony

They have: 9 posts

Joined: Oct 2002

Try this link...is this what you are trying to do?

http://www.coconutpalmz.com/test/logo.html

Over, Down, Click, Out
on the image

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

Oooh, that's quite clever! Wink

They have: 9 posts

Joined: Oct 2002

I just saw the link you posted...
I guess I misunderstood...mine is a basic over, down, click and out...
I will see if I can do something with an animated gif...

They have: 447 posts

Joined: Oct 1999

i really doubt what youre trying to do is possible with javascript, although it's an excellent idea and it's a shame that it's not. it'd be nice to be able to keep all our rollovers as single images rather than seperate 'up' and 'over' images.

animated gifs animate, nothing you can do to stop that with js, an image is an image, a gif is a jpeg, as far as javascript is concerned. it may be possible with an applet, but probably not worth the effort.

dk01's picture

He has: 516 posts

Joined: Mar 2002

I have seen sites that show how to do animation with javascript. I bet if you modified their code you could load certain frames with a function. Guess it'd be a lot of work.
-dk

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

Quote: Originally posted by R0B
animated gifs animate, nothing you can do to stop that with js, an image is an image, a gif is a jpeg, as far as javascript is concerned.

Unfortunately that's what I was thinking too Smiling

Quote: Originally posted by R0B
it may be possible with an applet, but probably not worth the effort.

If other solutions won't work, I might actually try it. I know some basic Java so I think it could work. Never thought of a Java solution for this one. Thanx!

Quote: Originally posted by dk01
I have seen sites that show how to do animation with javascript.

Altough I appreciate your help, I'm not looking for a script that does animation (If I was, I would modify and use this one).

cheers,

Shakespeare: onclick || !(onclick)

jammin's picture

They have: 222 posts

Joined: Sep 2002

Quote: The total number of anigifs is 1,500 or so and I don't feel like splitting them all manually into two or three different gifs...

it isnt that hard to split the gif files, especially when compared to figuring out an applet to do the stuff instead, and im pretty sure it is the only way you are going to get it to work like you want it to.

anyone can do any amount of work provided it isnt the work they are supposed to be doing.

They have: 24 posts

Joined: Feb 2002

I haven't read te whole thread but maby simple javascript function could do the trick?
Just make a function that takes image as the first variable and timer as the next.

onMouse="funcChangeImage('img1',0); funcChangeImage('img1',1000); "
onMouseOut="funcChangeImage('img1',0)"

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

Hmmm... that could actually work. I'll try it tomorrow when I'm back @ work.

Thanx!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.