[Tweener] Tweens group current state
Zeh Fernando
zeh at zehfernando.com
Fri Aug 1 20:52:56 PDT 2008
> PRERENDERING some stuff into btimap and use those later! Great idea btw!
> This would make some heavy sfx that normally eats-out the cpu run
> smooth, wow,
> i never thought about that in this terms!
> Zeh, you got any live examples of prerendering animations into bitmaps
> with tweener?
None that I can link to. The one I mentioned was first suggested by Mr.
Doob (Ricardo Cabello), he needed a single animation where every frame
was saved to a bitmap. It was actually the first time I saw a really
serious reason for .useFrames.
> What kind of "optimization" should i consider when animating a lot of
> stuff on screen?
> I know that's a bit off-topic, but you got the experience and knowledge
> i definitely lack :-)
I don't think there's any kind of magic solution here. It's basically
avoid redrawing what's not needed, and make sure what's NEEDED is drawn
in the easiest way possible.
Try to keep the 'dirty rectangle' (the area that needs to be redrawn) as
small as possible, avoid things that may sound simple but are actually
quite expensive to draw (gradients and pretty much every kind of vector
- bitmaps are always faster than vectors), avoid as many polygon 'edges'
as possible (they require antialiasing), text is also very expensive,
use cacheAsBitmap with caution (it may help as well as it may break your
animation), be careful with blending modes (sometimes you can simulate
them without having to use them, so get rid of unnecessary "multiplies"
or "screens"), ALWAYS use scrollRect instead of boxed masks if you can
(it forces you to use rounded transformation values), if a filter has to
be redrawn every frame be sure to use some low filter quality as well as
making it as small as possible, be sure to hide stuff with visible=false
instead of alpha=0, ... etc.
Really, it's a matter of testing different approaches and making things
as simple as possible. Test to see what's slow and what applies or not
if you're doing something that's not fast enough. Even the stuff I
mentioned above may not be true under certain circumstances.
With Tweener, using .rounded:true (rounded values) helps, SPECIALLY with
Flash Lite; and using .skipUpdates:1 (or higher) also helps if there's
some kind of specific tweening that requires major processing (like
redrawing a filter) and you want it to have a lower "framerate" than the
other tweenings (skipUpdates:1 makes it skip 1 rendered frame for every
frame update, so it drops the tween value update frequency in half).
Zeh
More information about the Tweener
mailing list