开发者

building animation in flex

开发者 https://www.devze.com 2023-01-15 02:12 出处:网络
I am trying to build animation based on mathematical formulae(speed varying with time as per equations)- hence am charting x,y coordinates with formulae on user provider values, rather than inbuilt fu

I am trying to build animation based on mathematical formulae(speed varying with time as per equations)- hence am charting x,y coordinates with formulae on user provider values, rather than inbuilt functions

In doing that, am struggling to get the timer right. for e.g if I set timer=new timer(1), object.x=object.x+1

the object doesn't zoom past screen within a second (or 600 milliseconds)- takes closer to 6-7 second to cover the 600 odd pixels. presume screen update doesnt work as fast as timer ticks

Is there a way for me to set up, such that I can predict speed on screen so animation takes abt 30 seconds?开发者_如何学编程


Its better to use ENTER_FRAME listener and do animation there, based on current time (getTimer()).

Update: see getTimer() docs: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/utils/package.html#getTimer%28%29

Note the time when animation started. On each frame, subtract start time from current time. You get number of milliseconds passed. Compute coordinates/colors/rotations based on that number.

0

精彩评论

暂无评论...
验证码 换一张
取 消