4 Replies Latest reply on Aug 18, 2006 2:03 PM by kglad

    Time based animation

    Lisa Chan Level 1
      If this topic has already been posted, can someone point me to it, please?

      Can someone please tell me how to do scripted animation that won't change if the frame rate slows down?
      So If I'm trying to move a circle from x=0 to x=100 in 10 seconds it always takes 10 seconds (not 12 on a slower machine) regardles of the framerate.
      I hope this makes sense. :)
        • 1. Re: Time based animation
          Level 7
          Lisa,

          > Can someone please tell me how to do scripted animation
          > that won't change if the frame rate slows down?

          Rather than basing it on frame rate -- such as, say, a
          MovieClip.onEnterFrame event handler -- you base it on millisconds.

          > So If I'm trying to move a circle from x=0 to x=100 in 10
          > seconds it always takes 10 seconds (not 12 on a slower
          > machine) regardles of the framerate.

          You *always* risk a variance in speed on slower machines. It depends as
          much on *what* you're animating -- is it semi-transparent? does it have
          thousands of vertces? -- as how you animate it. Rather than updating your
          MovieClip instances' _x and _y properties on onEnterFrame, update them based
          on setInterval().


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Time based animation
            kglad Adobe Community Professional & MVP
            it makes sense but can't be done. animation is host machine dependent meaning there's no way to force a slow machine to play a complex animation quickly.

            however, moving a circle from 0 to 100 is not complex and should not cause a problem in any maching made in this millenium. (if you're using flash 8 you can cache your circle movieclip's bitmap and make more efficient use of the flash 8 player.)
            • 3. Re: Time based animation
              Lisa Chan Level 1
              ^__^ Thanks, guys. So there is no way to display an object (any object) independent of the frame rate and without using setInterval() only?
              • 4. Re: Time based animation
                kglad Adobe Community Professional & MVP
                you could use the tween class. i'm not sure if (under the hood) it uses setInterval() and/or the frame rate, but the flash coding would not use either.