473,770 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2454
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.

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.javas cript 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.c omwrote in message
news:11******** *************@b 28g2000cwb.goog legroups.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
8719
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 FrontPage and 'Preview in Browser'. However, When I enter the URL or when I 'select all' html and paste it into the 'add your own html' box in ebay, the gif's don't animate. If anyone would take the time to scan my 'index.htm' and let me know what...
2
2667
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 viewer once or twice per minute, at unpredictable intervals. I think I could figure out how to use rand() and setTimeout(...) to create the random time intervals, but I'm not sure about how to start the one-loop animated gif. Would I have to...
2
1961
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 (radar1.jpg, radar2.jpg etc). I'm preloading the pictures into an array, then displaying the pictures in sequence using setTimeout to call the animate() function to load the next in the sequence as each one is displayed. Nothing clever, and it's no more...
3
3445
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 load. When location.replace is called the animated GIFs in the first page stop animating. Is this standard behaviour? If so, is there an easy work around to prevent this?
4
20629
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, Al
7
6336
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 that I get is a box with nothing in it. It almost seems as if the file will not open on my page, let alone animate. It still works fine with my Netscape browser. I am using Windows 98. Any ideas would be appreciated. Thanks,
4
6367
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 unpredictable. If I connect it to the onload event, sometimes only half the page will be displayed. Does the onload even fire before rendering? Does anyone know a reasonable way to accomplish my original goal of
0
1010
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 visual studio program I am writing. I am having trouble conserving the animation (that is, I am able to import the images into visual basic, but once in they are no longer animated). Also, I am having problems with the random function. My goal here is...
0
953
by: Freelancer Deepak | last post by:
How can i save my animated file in adobe imageready as gif animated images
0
9617
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10257
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10037
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.