PDA

View Full Version : A Flapping Flag ??


Mel Smith
06-26-2009, 07:36 PM
Hi:
I would like to have a small U.S. flag gently 'flapping' on my main page.

Problem 1:
Where can I get a small image like this. ?

Problem 2:
How do I make it gently 'flap' ??

Thanks for any suggestions.

-Mel Smith

bowrider
06-26-2009, 10:09 PM
How about an animated.gif?
check here
http://3dflags.com/world/american/national_flag/classic_waving_clip_art.html#

Just copy the image and insert into your code like any other image.

Mel Smith
06-27-2009, 12:45 AM
Bowrider:

Thank you for the link. I'll try it out.

The idea is what I need but I guess what I was looiiing for was a way to do it myself in .js with some flag gifs ??

-Mel Smith

mattmill30
06-27-2009, 09:07 AM
if you're trying to create this in javascript you will need to move/repost this into the Javascript area of the forum, as mostly only HTML/XHTML coders are in this area, and so you're unlikely to get help as quickly as you could.

Pegasus
06-27-2009, 10:39 AM
I've moved the thread over to Client-side Scripting for you, Mel.

coothead
06-27-2009, 12:18 PM
Hi there Mel Smith,

As an animated gif is the logical method to use, I would presume that you only want a
javascript animation to further your knowledge rather than for practical considerations. :agree:

Check out the attachment for the extremely simple javascript animation. :agree:

Mel Smith
06-29-2009, 01:47 PM
CootHead:

Thanks for the attachment. I'll check it out larter today (after a visit to the dentist).

Yes, I'd like to learn js, and I keep running around in circles 'barking at it'. Maybe this small animation will help me advance a little.

-Mel Smith

coothead
06-29-2009, 02:26 PM
Hi there Mel Smith,

let us know if you have any problems with it. :agree:

Mel Smith
06-30-2009, 12:32 AM
Coothead:

It works great !

I even tried bringing the first .gif by itself to my home page, and it displayed nicely.

I understand your comments and will stay on the legal side. It is still interesting to show the flapping flag which I can make smaller with Gimp2.

My only problem with understanding the code is the following:

Question:

It seems that the following code in the function keeps getting executed for each display of all the 11 images. I also 'guess' that the statements below account for FireFox and IE differences ??

OTOH, it seems that the animation function keeps calling *itself* to geater and grearter depths -- which in my previous incarnation as business programmer is a no-no. I guess I'd better go back to Flanagan's Javascript for more reading ...

***************

if(window.addEventListener){
window.addEventListener('load',animattion,false);
}
else {
if(window.attachEvent){
window.attachEvent('onload',animattion);
}