Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Animation

Posted on 1998-04-29
3
Medium Priority
?
334 Views
Last Modified: 2013-12-25
I have a document with ten pictures on it. I am trying to get the tenth picture to be an animated version of all the others - it will cycle between image 1, image 2, image 3... etc

1) How can I do this without using a seperate object for each picture (can I, since they are already on the page somewhere)?

2) How do I string the frames together? I tried setting my animate procedure in the mouse over event of all the links on the page, but that still only works if the user moves the mouse continuously over the page!!!!

If someone could provide commented source for this, I would be happy to give you a buncha points and my first born male child.

Thanks!!!!!!!
0
Comment
Question by:cheeseman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
jbabcock earned 800 total points
ID: 1854394
Answer coming...
0
 
LVL 1

Expert Comment

by:jbabcock
ID: 1854395
Hi!

You don't need to use mouse events to achieve that. Rather, you should set a timeout on the window, and let it repeat your
procedure every so often.

First you need to name all those images you want to animate. Make sure the names have the same prefix, and sequential
numbers, like so -


    <IMG SRC="Picture0.gif" NAME="Logo0">
    <IMG SRC="Picture1.gif" NAME="Logo1">
    <IMG SRC="Picture2.gif" NAME="Logo2">
    <IMG SRC="Picture3.gif" NAME="Logo3">
    <IMG SRC="Picture4.gif" NAME="Logo4">
    <IMG SRC="Image5.gif" NAME="Logo5">
    <IMG SRC="Image6.gif" NAME="Logo6">
    <IMG SRC="Image7.gif" NAME="Logo7">
    <IMG SRC="Image8.gif" NAME="Logo8">
    <IMG SRC="Image9.gif" NAME="Logo9">


and you need to name the image you want to animate -


<IMG SRC="Image9.gif" HEIGHT=151 WIDTH=135 NAME="Swap">


Now you need to add the engine to swap them.


    <SCRIPT LANGUAGE="Javascript">
      <!--

        // this tests for a browser that can animate images in this manner
        browser = (((navigator.appName == "Netscape") &&
                    (parseInt(navigator.appVersion) >= 3 )) ||
                   ((navigator.appName == "Microsoft Internet Explorer") &&
                    (parseInt(navigator.appVersion) >= 4 )))

        // the last frame of our animation
        MaxFrame = 9;

        // frame to start at
        TimerStep = 0;

        // ticks between frames
        TimerSpeed = 120;

        // this will be our main function
        function TimerTick() {

          // if we found a browser this will work in      
          if (browser) {

            // go to the next frame
            TimerStep++;

            // return to the first frame if we pass the last
            if (TimerStep > MaxFrame) {
              TimerStep = 0;
            }

            // swap to the next image
            document ["Swap"].src = document ["Logo" + TimerStep].src;

            // set the timer
            window.setTimeout("TimerTick()", TimerSpeed );
          }
        }

      //-->
    </SCRIPT>


Now, all you have left to do is to start it all off by running the TimerTick procedure when the document loads -

<BODY onLoad="TimerTick();">


Hope this helps!
0
 

Author Comment

by:cheeseman
ID: 1854396
Thanks alot! I'll FedEx you the kid right away! =)
0

Featured Post

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

671 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question