Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / August 2006



Tip: Looking for answers? Try searching our database.

Animated images

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lando - 31 Aug 2006 13:08 GMT
Can javascript build animated .gif or .jpeg ....I mean files *gif or
*.jpeg that show animated images when are opened ( or is it another
language that do it ? ) ?
Thanks a lot.
Yanick - 31 Aug 2006 13:31 GMT
> Can javascript build animated .gif or .jpeg ....I mean files *gif or
> *.jpeg that show animated images when are opened ( or is it another
> language that do it ? ) ?
> Thanks a lot.

Javascript can set an <IMG> element's src property to an image url. If
the image is an animated GIF, then it will be animated by the browser.
If you whish to build custom animation with a collection of images, you
have to use a time that will change the src property value of the
element to the next image in line. Something like :

var _imageId = "someImageElementId";
var _imageQueue = new Array();
var _index = 0;

// 1) load image queue with url as _imageQueue[n] = "url";

function setNextImageIndex() {
 var image = document.getElementById( _imageId );
 if ( image ) {
   _index++;
   if ( index >= _imageQueue.length ) index = 0;

   image.src = _imageQueue[_index];
 }
}

setInterval( setNextImageIndex, 200 ); // change image 5x per seconds

--------------------

The images should be of the same size... but they can be of different
formats (all must be supported by the browser !). The browser is
supposed to use the cached version of the images, but if you whish, you
can preload the images first... but I'll let you search for more
invormations about this on your own (Google is your friend.)

Hope this helps.
Randy Webb - 31 Aug 2006 13:34 GMT
Lando said the following on 8/31/2006 8:08 AM:
> Can javascript build animated .gif or .jpeg ....

No.

> I mean files *gif or *.jpeg that show animated images
> when are opened

.jpeg can be animated?

> ( or is it another language that do it ? ) ?

Not another language, a type of program. You want an image manipulation
program such as PSP or any other one that is capable of producing
animated images.

Signature

Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

Tom Cole - 31 Aug 2006 16:13 GMT
You can simulate animated graphics using only javascript as noted in
the first reply (by using a timer and changing the src attribute of the
image DOM element.

But, you can actually create an animated GIF file using a piece of
freeware called GIFAnimator
(http://www.versiontracker.com/dyn/moreinfo/win/13212). There also use
to be the GIF Constructor Set, but I don't know where it went.

There are many more GIF animation utilities for a small fee out there.
Just Google it.
Marc - 31 Aug 2006 20:21 GMT
> You can simulate animated graphics using only javascript as noted in
> the first reply (by using a timer and changing the src attribute of the
[quoted text clipped - 7 lines]
> There are many more GIF animation utilities for a small fee out there.
> Just Google it.

Or go funky with css and clip... like so:
http://www.braincast.nl/oi/oi8/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.