[Golist] Using Go w/HydroTween
Moses Gunesch
moses at goasap.org
Thu Jan 17 12:06:22 PST 2008
I mentioned that I'd used Go to script a stop-motion animation player,
which worked great, but hilariously I haven't had a need in my project
to run any normal tweens, until just yesterday!
So I grabbed Donovan's all purpose tween class, HydroTween, which
works a lot like Tweener syntax-wise. I had no problems with it
whatsoever! It was easy... as easy as any other tween engine. Thanks
Donovan! (available at his Hydrotik.com blog)
Personally for AS3, I like being able to make a tween that you can
store in a class. I had an animation of a big tab that slides up and
down for it's show / hide. So instead of making a new tween every
time, I simply stored one tween as a private class property, then run
stop(), reset the position and call start() on it to use it. Very
simple!
I also like this because as3 makes you think about memory management
and object creation....
Every time you create a callback or event in as3 you're creating a
method-closure object internally that stores tons of references to its
surroundings, so they're a bit more prone to memory leaks than other
features of the language. Object creation also takes time and
processing. So, having a single tween object in memory with a single
method-closure reduces the processor hit quite a bit compared to the
normal actions of a sealed tween engine (which generates and destroys
new tween instances and closures constantly as it runs).
Go exposes the engine so that you have control over whether you want
to make a helper class (a la Tweener) to manage tweens for you, or
whether you want to keep control over them as I did in this example
and minimize what takes place behind the scenes.
- moses
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://goasap.org/pipermail/golist_goasap.org/attachments/20080117/5ead12ff/attachment.html
More information about the GoList
mailing list