Re: MNG?
by Melanie Gann <mgann(at)second-street.com>
|
Date: |
Tue, 05 Mar 2002 13:18:00 -0500 |
To: |
Adrian Harris <adrian(at)gn.apc.org>, hwg-techniques(at)hwg.org |
References: |
SOWINSO |
|
todo: View
Thread,
Original
|
|
Below is a javascript that allows you to rotate through images. I use this
rather than animated gif when I must use jpegs.
Hope it helps.
Melanie
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Robert Bui (astrogate(at)hotmail.com) -->
<!-- Web Site: http://astrogate.virtualave.net -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
var interval = 2.5; // delay between rotating images (in seconds)
var random_display = 1; // 0 = no, 1 = yes
interval *= 500;
var image_index = 0;
image_list = new Array();
image_list[image_index++] = new imageItem("images/hollyongrassS.jpg");
image_list[image_index++] = new imageItem("images/hollyprettyS.jpg");
var number_of_image = image_list.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
image_index = generate(0, number_of_image-1);
}
else {
image_index = (image_index+1) % number_of_image;
}
var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}
function rotateImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = "rotateImage('"+place+"')";
setTimeout(recur_call, interval);
}
// End -->
</script>
At 04:01 PM 3/5/02 +0000, Adrian Harris wrote:
>Hi,
>a client has a logo with a gently shading colors area included. It looks a
>mess in GIF as the shading forms in to bands. A JPEG looks fine, but they
>would really like to animate part of it. The section they want animate
>works OK as a GIF, so I could slice that off, animate it and put it into a
>layer over the JPEG. But in my experience (not extensive) layers move
>around in different browsers, so I'm not too keen on this plan!
>
>Flash is an option (I think), but one I'm trying to avoid as the whole
>plug-in issue comes up. Maybe I'm being a bit prejudiced about Flash?
>
>The coming soon MNG format is the answer to my needs, but who supports it?
>The Applications with MNG Support page I found
>(http://www.libpng.org/pub/mng/mngapps.html) only lists Mozilla and NN
>versions 6.0 and 6.01.
>
>I'm about to tell the client it can't be done reliably at the moment, but
>thought I'd run this one past you guys!
>
>TIA.
>
>
>
>Best wishe,
>Adrian Harris M.A.
>
>Member of the HTML Writers Guild
>
>http://www.hwg.org/
>
>GreenNet Design: World Class Web design that won't cost the Earth
>
>http://www.gn.apc.org/design
>
Second Street Web Design
http://www.second-street.com
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA