473,387 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Animated images

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.
Aug 31 '06 #1
4 2429
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 = "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.

Aug 31 '06 #2
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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 31 '06 #3
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.

Aug 31 '06 #4

"Tom Cole" <tc****@gmail.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
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.
Or go funky with css and clip... like so:
http://www.braincast.nl/oi/oi8/
Aug 31 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: DOK | last post by:
I'm trying to create an eBay ad. So far, I've got the page the way I want it. However, the few animated gif's I have on the page display but are no longer animated. I can get it to work in...
2
by: Salmo Bytes | last post by:
I want to make an animated gif that runs through one loop and then stops. But I want to invoke it at random time intervals...so, for instance, a tight head shot of a person's face winks at the...
2
by: Malcolm | last post by:
I'm afraid I'm a newbie to javascript coding, so I hope this isn't too silly a question. Basically I'm trying to display a simple animation of a sequence of 24 hourly rain radar pictures...
3
by: Al | last post by:
Hi all... I have created an aspx page that contains an animated GIF. I am using javascript and location.replace to redirect from this page to another aspx page which takes several seconds to...
4
by: Al_C | last post by:
It's not that I expected it to work, but can anyone explane why if I put an animated gif as the background image of a form it is no longer animated? Is there any way to actually do that? Thanks,...
7
by: Gary Kaucher | last post by:
At the top of the page on my website http://www.itemlook.com I have an animated gif called "eyeline.gif". It has worked fine in the past, but recently I am unable to get it to work using IE6. All...
4
by: Jeff | last post by:
Hi, I'd like to write Javascript that stops animated gifs from animating. On Firefox, at least, window.stop(); does the trick, although it stops everything on the page and is kind of...
0
by: cogsci | last post by:
Hello, I have created 25+ animated images each saved as an image file (at present a png file). I have been trying to import them in a random fashion into a picture box that I created in the...
0
by: Freelancer Deepak | last post by:
How can i save my animated file in adobe imageready as gif animated images
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.