GTweeny: Lightweight (3kb) AS3 Tween Engine

GTweeny is GTween‘s lightweight younger sibling. It strips a lot of the secondary features of GTween (proxy, timing modes, etc) in favour of smaller file size. It is currently under 3kb, but I’m looking for feedback on this class: is a 1.5kb savings even worth it? Should I strip it down further to make it a 2kb core tweening class?

I’m leaning towards smaller, but I’m interested to hear what other developers think, particularly those working on banner ads. We don’t typically do banner ads at gskinner.com, so we are unlikely to use GTweeny internally.

Regardless of GTweeny’s future, this ~4kb 3D image gallery makes for a pretty decent demo. Flash player 10 required.

You can check out additional demos of GTween beta 5 at it’s home page at gskinner.com/libraries/gtween/.

Grant Skinner

The "g" in gskinner. Also the "skinner".

@gskinner

16 Comments

  1. This is awesome Grant. How does your new tweening library compare performance wise with TweenLite and other tweenig libraries?

  2. Would it be possible to attach the raw AS code for this one to the post? I’ve downloaded the code, but of course, this one requires Flash CS4 to view the code and I only have CS3. I currently use Flex for any FP10 stuff, so all I really wanted was the code 🙂

    If you want to email it to me instead of posting the code, that would work fine with me too.

  3. Mark – ya, I was just thinking about that. I think I will post an updated package with all the code in a separate text file for those using Flex. Should be up this afternoon.

  4. some strange behavior, roll over the swf in this page and then move out of the browser window and double click the desktop, the panel with all those thumbs suddenly moves erratically, Mac G5 PPC 10.4.11, Safari 3.2.1, FP 10.0 r12.

    besides, cool lib! will sure use it!

  5. A – that’s actually an OSX player 10 issue. The player generates mouseMove events when you click outside the SWF. That generates weird mouse coordinates, and causes the demo to go a little crazy. It would be easy to fix by adding some restraints on the values (Math.max / min).

  6. jimb – Performance is definitely not my top priority. I’m much more concerned with functionality, code clarity, ease of use, and stability/reliability.

    That being said, from my rough testing, this version of GTween is a bit faster than the previous version. Other people’s testing had shown that previous versions of GTween were not as fast as TweenLite (Jack’s done an awesome job there), but faster than all the other major engines.

    GTween can easily handle over 1000 active tweens. Other than a particle emitter (which shouldn’t use a tween engine anyway), it’s unlikely you’ll ever have that many tweens, and if you do, the bottleneck is going to be rendering and compositing, not tweening.

    The demo on the gTween home page shows it generating about 3000 tweens per second, and on my system it can sustain about 40fps. Note that it seems to run a bit slower in the lightbox – I’ll have to post a stand alone version.

  7. Great slim version of the gTween library. I’ve one question about it: under which license will it be availabe. MIT as the gTween lib or have you anything else in mind?

  8. Benjamin – yes, GTweeny is licensed under MIT with the rest of the library.

  9. I have been following up with almost all the Tween Engines for some time and I have just started to think if this competition (yes, that would be the word I will use) is getting a little too much. There are too many Tween Engines present for Flash Devs (Tweener, TweenMax, GTween, Tweensy, Twease, GoASAP, etc) and it is really getting difficult for us Flashers to focus on one and to use it. You get use to with any one of them and then you hear of some enhancements on any other engine and we start feeling if it is the time to switch to this one. I really appreciate (and I am sure the others do the same) the openness and the competitive nature we Flashers possess; but sometimes I feel that we actually don’t team up. Why not think about getting all the gurus of those different Tween Engines together and create one master piece.

    I know it is a bit slight off the topic but as my RSS reader popped this article I had started to feel all this. Just sharing my thoughts.

  10. Hi Grant,

    I make banner ads all day, and we use TweenLite, just because it’s the smallest.

    When you’re trying to get your banner down to under 30k but you can only manage to get it down to 33K, every k counts. 1 or 2 k can make a huge difference when making banner ads!

    Make your lite version as small as possible, or don’t bother making a lite version.

    love your work.

  11. Sam – of course smaller always comes at the expense of features. So the inevitable question is, what is the minimum set of features you would want to build banner ads? The plan is to maintain a subset of GTween APIs in GTweeny, so that if you need to you can swap in the more feature rich library without changing your code.

  12. This is the smoothest 3D demo I’ve seen so far. I’ve a P4 which is now 6 years old and it runs the demo perfectly. I’m pretty impressed. Nothing before Flash Player 10 I’ve seen this efficient, not even the nice demos with Five3D.

    Thanks for showing and of course thanks for GTween.

  13. My vote would be for the smallest, and most efficient tweening class. Then I could use it for Flash mobile development. Thanks!

  14. Hi Grant,

    Is it true that you are collaborating with Jack (TweenLite) ?

    If yes, when can we expect to see a beta version?

  15. Will this run in flashlite 2 and or 3? Which engine is best for mobile platforms running flash lite 3.0?

  16. Hi, I am a student trying to make this code work for me, I am just a student though and not completely comfortable in flash. I do not know how to make it work with multiple images. Can you help me? I would greatly appreciate it.

    thanks, Gerard

Comments are closed.