[swfmill] newbie: creating animation from a series of jpg files various timings
Christopher Brian Jack
brian at brians-anime.com
Fri Mar 23 03:09:08 EST 2007
On Fri, 23 Mar 2007, XIX wrote:
> The frame rate you ask for and the frame rate flash actually runs at
> seldom seem to be the same. I don't mean frame dropping due to
> rendering time. From personal tests I've seen a request for 30fps
> actually yield 25fps even when nothing is being drawn and the cpu is
> 90% idle.
>
> Just something to remember if you experience timing problems.
My suggestion is to make objects you can control the points on (with HaXe
or AS) and use fractional translation based on a reliable timing source
(like the millisecond counter) to adjust animation frame-to-frame when
animation needs to synchronize to other things like music or other logic
(such as you might have in a game).
I'd recommend making a generalized class for handling fractional
translation and then a derived class that can load an object and display
it to the apporpriate translation on each frame's render-pass
(onEnterFrame).
<pre>
deltaMSec
------------ : (state_b - state_b or deltaStateAB)
totalMsec
</pre>
deltaMSec starts at 0 (then record the time that the action starts
let's call it startTime), totalMsec is the time (in Msec) that you want
the translation to take from complete the change from state_a to state_b
on each pass (onEnterFrame) you compute deltaMSec as curTime-startTime
(curTime can be had with a function call) and clamp deltaMSec to the range
max(deltaMSec,0) and min(deltaMSec,totalMsec)
Multiply the ratio to get (deltaMSec * deltaStateAB) / totalMsec
and this gives you the translation for that frame.
.=================================================.
| Christopher BRIAN Jack aka "Gau of the Veldt" |
+================================================='
| oevna at oevnaf-navzr.pbz
`=================================================-
Hi Spambots, my email address is sputnik at brians-anime.com
Hi Humans, my email address uses rot13 cipher
More information about the swfmill
mailing list