Lando wrote:
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 <IMGelement'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 = "someImageEleme ntId";
var _imageQueue = new Array();
var _index = 0;
// 1) load image queue with url as _imageQueue[n] = "url";
function setNextImageInd ex() {
var image = document.getEle mentById( _imageId );
if ( image ) {
_index++;
if ( index >= _imageQueue.len gth ) index = 0;
image.src = _imageQueue[_index];
}
}
setInterval( setNextImageInd ex, 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.