Results 1 to 3 of 3

Thread: animeishun

  1. #1
    Join Date
    Dec 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default animeishun

    I tried to create an animation but it didn't work!


    Here is the code:
    ***
    Code:
    <html>
    <head>
    <script language="javascript">
    
    one=new Image()
    one.src="1.gif"
    two=new Image()
    two.src="2.gif"
    three=new Image()
    three.src="3.gif"
    
    pic= new Array()
    pic[0]=one.src
    pic[1]=two.src
    pic[2]=three.src
    
    var a=0
    var x
    
    function animation()
    {
    clearTimeout(x)
    document['tmuna'].src=pic[a]
    a++
               if(a>2)
               a=0
    x=setTimeout('animation()',1000)
    }
    </script>
    </head>
    <body onload="animation()">
    <img name="tmuna" src="1.gif">
    </body>
    </html>
    ***


    tintinfreak

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    There really is nothing fatally wrong with your code. Works fine as is in FF and IE. Your choice of images is a bit odd though. If you want it to look like an animation, each frame (image) must follow logically from the previous one in a way which simulates the type of movement you want. Yours goes from a blank line to a line with one dot then to a line with two dots then back to a blank line and on and on. If you want to simulate movement, go from a blank line to one with one dot to another with one dot but in another location than the first dot. These things are better done using animated .gifs though, less overhead:

    Attachment 210
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1
    There really is nothing fatally wrong with your code. Works fine as is in FF and IE. Your choice of images is a bit odd though. If you want it to look like an animation, each frame (image) must follow logically from the previous one in a way which simulates the type of movement you want. Yours goes from a blank line to a line with one dot then to a line with two dots then back to a blank line and on and on. If you want to simulate movement, go from a blank line to one with one dot to another with one dot but in another location than the first dot. These things are better done using animated .gifs though, less overhead:

    Attachment 210


    Thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •