Director-like multi-image "sprite" animation

Brian Yennie briany at
Tue Jan 27 16:21:31 EST 2009

I don't know how far these points will get you, but I would suggest a  
few things:

1) If you want to run multiple animations, create your own "frame"  
event. For example, if you want a frame rate of 25fps, set off a  
"frame" event every 40ms. Leave the frame rate as a setting which you  
can adjust. Then on each frame event, update all of your animations at  
once. Picking a reasonable frame rate gives you something to shoot  
for, optimize against and quickly figure out how far you need to go /  
what is realistic.

2) Somewhere around 20-25 FPS should be sufficient for a walk cycle  
although of course it looks better at higher rates. Even 15 fps might  
be enough for drawn animation.

3) Optimize the heck out of your code since Rev isn't well optimized  
for animation out of the box. Squeezing another 1ms out of something  
may actually be a big deal here or at least will stretch the limits of  
what you can do. For example, if a button's location hasn't actually  
changed by a full pixel, don't bother moving it. The extra check might  
be faster than setting the location of things to their current  
location and forcing a visual update. Just a guess / example.

Obviously any small optimizations add up fast if you are doing a lot  
every 40ms, but a setup like the above may help you work it out!

> I may have a need soon to try my hand at putting together some mult- 
> image sprite animations like the sort of thing we commonly see done  
> in Director.
> But since Director's engine is well optimized for that sort of thing  
> and Rev isn't, I'm not sure Rev is up to the task.
> For example, one of these "sprites" is a 900-frame animation of a  
> walking figure that needs to be anti-aliased against an image  
> background.  The figure itself is about 200px by 200px.
> That's a lot of images, and I can't imagine that swapping those out  
> of a button icon while also moving the button will be all that smooth.
> Or can it be?
> And what if I need to have two or three of those running at once?
> Should I give it up, or have any of you had success doing this sort  
> of thing in Rev?
> --
> Richard Gaskin
> Fourth World
> Revolution training and consulting:
> Webzine for Rev developers:

More information about the Use-livecode mailing list