homepage Welcome to WebmasterWorld Guest from 54.196.168.78
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / Site Graphics and Multimedia Design
Forum Library, Charter, Moderator: open

Site Graphics and Multimedia Design Forum

    
Control animated gif
Pacoglen




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

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




msg:852917
 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




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

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




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

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




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

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

Pacoglen




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

Yeah but no transparency under Netscape :-(

toolman




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

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




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

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




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

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




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

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




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

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




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Site Graphics and Multimedia Design
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved