Welcome to WebmasterWorld Guest from 54.144.77.26

Forum Moderators: not2easy

Message Too Old, No Replies

Control animated gif

     

Pacoglen

4:02 pm on May 29, 2001 (gmt 0)

10+ Year Member



I wonder if it's possible to control the start of an animated gif with a mouse over ?

If i have an animated gif that doesn't loop but that i want to play on a mouse over, the problem's that it play right after it preloaded so when i mouse over the button, all i see is the last frame of the anim.

And i don't want to load the gif on mouse over, it has to be preloaded.

So big challenge ?

Everyman

4:25 pm on May 29, 2001 (gmt 0)



Welcome to WmW, PacoGlen.

I don't think you can do it with JavaScript and a GIF, as the animation is started by the browser internally as soon as it detects that the loaded GIF is animated.

You'd have to use a Java applet, and even then you probably could not use a GIF, but would have to do an on-the-fly PAINT of the screen on mouseover, with the data file already preloaded with the Java applet, with all the bitmap (pixel) info in that data file for the new image. That's the only way I can think of to avoid loading the image on mouseover.

The actual PAINT in the Java applet would be fast enough, but the overhead for getting the applet downloaded and set up in the first place would be intolerable.

JavaScript is not able to access the screen effectively on a pixel level. You need a Java applet for that.

Drastic

4:35 pm on May 29, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Could javascript be used to switch from a static gif to the animated one on mouseover? The animated gif could be preloaded in the head.

Pacoglen

5:23 pm on May 29, 2001 (gmt 0)

10+ Year Member



Yeah but that is what i already tried.

I think Everyman has spot the problem... it's a Browser restriction and no script will fix that.

I'll just find another way to get the thing running well.

Thanks for your help guyz !

havanice day.

knighty

8:09 am on May 30, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



or just use flash...lot simpler and a lot smaller ;)

Pacoglen

1:18 pm on May 30, 2001 (gmt 0)

10+ Year Member



Yeah but no transparency under Netscape :-(

toolman

2:31 pm on May 30, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you slice the part of the background out of your page (if it's a pattern, if it's a color that's a no brainer)and then import it into the Flash movie as the background you can create the effect of transparency.

I've even seen MM extensions that control Flash movies using js. Go to MM Exchange.

mivox

9:13 pm on May 30, 2001 (gmt 0)

WebmasterWorld Senior Member mivox is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome Pacoglen... must say I haven't tried what you want to do, so I'm afraid I can't be of much help.

I've thought of using animated gifs for mouseovers before though, and I'd like to say "Thanks" for saving me time & frustration in the future! ;)

Xoc

2:40 am on Jun 1, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I haven't tried it, but what if you had two graphics, one static representing the first frame, and another the animated gif. On the mouseover, you used EcmaScript (aka JavaScript) to hide the static gif and show the animated one? I would think that a typical web browser would start playing it when it showed.

Pacoglen

1:50 pm on Jun 1, 2001 (gmt 0)

10+ Year Member



nope.
It start playing it as soon as its loaded even if it's hidden.

Because it was something that had to be put on many website, i couldn't use flash and fake transparency by copying the background.
There was just too many.

So i just didn't preload the gif because anyway it wasn't very big (5k).

Xoc

2:55 am on Jun 2, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmmf. Darn web browsers never do what you want. :) Imagine, they are merrily consuming resources playing an animated gif that you can't even see. I suppose they are playing animated gifs that are off the screen, too. Oh well.

tedster

3:31 am on Jun 2, 2001 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



The challenge is the fact that you only want one loop on the animation. I've used onMouseover to switch from a static image to an animated gif. It works very well, but only for infinitely looping GIFs, as this thread uncovered.

The biggest challenge I found was that MSIE plays animations at different speeds from Netscape.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month