7 Replies Latest reply on Jul 17, 2007 1:19 PM by SymTsb

    Tweening: Frames vs Seconds

    iowaGuy Level 1
      I have been talking to a few other Flash developers who use quite a bit of tweening and found that they use seconds (true) when writing tweens, where i was always told to use frames (false). I am pretty sure I was told that when you use seconds (true) your tween relied on the users computer for the timing and that if the computer was "chugging" then the animation would not be smooth because of the time lag from it, and when you use frames (false) that it was reliant on the movie itself, which by the time you see it it has been completely loaded and shouldnt have problems. Below is an example of a tween setup to use seconds:

      new Tween(instance_name, "_y", Back.easeInOut, instance_name._y, 800, 10, true);

      I could be completely off on this, but I am pretty sure I was told this when I first started developing and since I don't generally use too much actionscript I just need some clarification.

        • 1. Re: Tweening: Frames vs Seconds
          Damon Edwards Level 3
          I never use frames.. I'd rather use seconds, I guess it's just personal preference..
          "seconds (true) your tween relied on the users computer for the timing"
          This doesn't sound valid to me, time doesn't change if a computer is slowing down, 1 second is 1 second anywhere you go. I would say it's the other way around, if the tween is based on frames, and the computer is having trouble with the animation, the fps will slow down, and therefore make the tween look choppy.
          • 2. Re: Tweening: Frames vs Seconds
            SymTsb Level 2
            Actually, in the long run, using a time based approach vs frames will have little impact and is really a matter of personal choice.

            Using seconds allows for correctly timed animations even in multiple FPS (say 12 vs 30) because 2 seconds is always 2 seconds where as if you need to use the movie or tween for for a different frame rate, you are often stuck having to mod code and re-export a file that you didn't want to adjust and now have to deal with other issues with other movies you may be working on.... In practice, usually you'll want to go with seconds because then Flash will deal with the math of getting it to the correct number of frames which supports the idea of re-usable code.

            In terms of smooth vs choppy, I'd tell those people they need to look at their frame file sizes and try to pull that down first. Choppy animation is almost always caused when there are too many vectors on the screen for the processor to handle which in turn affects the frame rate which will affect your tween whether it is in seconds or frames anyways. This is what I've learned in my time with Flash anyway.
            • 3. Re: Tweening: Frames vs Seconds
              iowaGuy Level 1
              That does seem like it would make sense, the only thing i have to question is if you use seconds does your code use the computer for its timing? The reason I ask is because another developer came to me with some jumpy tweens an a pretty heavy site, so i said i would look at it and see if i could help, so i changed everything to frames (false) and adjusted to match his timing and everything is smooth now... just trying to find some logic behind this fix so we are not just banking on "luck"

              • 4. Re: Tweening: Frames vs Seconds
                SymTsb Level 2
                To be perfectly honest, you probably saw a reduction because Flash didn't have to calculate how many frames were in x number of seconds if that makes sense. Math computations tend to kill the Flash Player or at least slow it to a crawl if there are enough of them.
                • 5. Re: Tweening: Frames vs Seconds
                  iowaGuy Level 1
                  Yeah that makes sense... thanks for everyones input
                  • 6. Re: Tweening: Frames vs Seconds
                    iowaGuy Level 1
                    We have come to the conclusion that if you are going to have a lot of tweens happening at the same time that you should consider using frames. Since flash is based around frames it seems like the most logical thing to do is use frames instead of seconds to avoid calculating the difference. Plus i tend to use the timeline and keep things in a .as file so using frames helps me keep everything clean and precise.

                    So i guess at the end of the day it really does come down to personal preference and using whatever keeps your animations clean.

                    • 7. Re: Tweening: Frames vs Seconds
                      SymTsb Level 2
                      You're welcome :D