Dynamic tweens not exporting correctly.

32 views
Skip to first unread message

karim beyrouti

unread,
Jan 13, 2015, 8:35:40 AM1/13/15
to


SWF Renderer exports animations in frame time, and as exporting a frame may take longer than 1/FramesPerSecond ( i.e. the animation is not exporting in real time) you might find that dynamic tweens loose frames or do not look as smooth as it does during playback. 


This happens because of the following:


1) of a large export size and scaling, or high AA quality being set and results in a SWF to render at less than the desired frames per second. ( this is not uncommon, as video applications would struggle to export and render 1080p content in real time )


2) Most tweening libraries animate tweens using delta time to keep animations in time regardless of the frame rate. ( here is a good explanation: http://bit.ly/1u2GsI0 ), so if an object is supposed to be somewhere in two seconds - it will be there no matter the number of frames in between. This can lead to lots of missed frames during the render.


The fix:

Fortunately, there is a simple solution you can implement that will fix this issue. If you are using TweenMax / TweenLite, it requires a few and simple changes to the code to enable the tweening library to use frames instead of delta time to render animation.


<as3>


var tweenTimeInSeconds : number = 5; // 5 second tween.
var frameRate : int = 25; // 25 Frames per second
var tweenFrameTime : int = tweenTimeInSeconds * frameRate; // multiply tween time by frame rate << SOLUTION
 
var tweenProperties : Object = new Object() ; // create a tween properties object
tweenProperties.x = 200; // tween moves x position to 200
tweenProperties.useFrames = true ; // << SOLUTION - enable frame time
TweenMax.to( movieclip , tweenFrameTime, tweenProperties);// Set the tween

</as3>


The above code is are telling TweenMax to use frame time (instead of delta time) with the ‘useFrames’ property, and setting the tween time to be frameRate * tweenTime. This should fix your issue.


If you are using another tweening engine, it should have the capability to use frame time somewhere. Please drop me a note if you are having any issues with dynamic tweens.


Reply all
Reply to author
Forward
0 new messages