Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Manual update/step ?

Recommended Posts

Is there any way to manually update/step through a tween?

My goal is to be able to pause a tween, and then step through the updates manually (maybe passing in an update/delta time?).


Any info on whether this is possible would be great!




Link to comment
Share on other sites

TweenLite/Max completely supports what you are talking about. There is a short description here: Tweening Tip #11


var myTween:TweenMax = TweenMax.to(target, duration, vars); // or...
var myTween:TweenMax = new TweenMax(target, duration, vars); // this is the same as the line above, but may be a more familiar syntax for some

myTween.pause(); // Pauses the tween ( you could also use paused:true in your vars when creating the tween )
myTween.currentTime; // Most recently rendered time (or frame for frames-based tweens/timelines) according to its duration.
myTween.duration; // Duration of the tween in seconds (or frames for frames-based tweens/timelines) not including any repeats or repeatDelays.

And, if you have a bunch of tweens, you might want to take advantage of TimelineLite/Max to make it even easier. Timelines also have a currentProgress value which goes between 0 and 1, and this can also be manually updated / tweened.

Link to comment
Share on other sites

Thanks for the reply, but thats not quite what I meant. I am looking for a way to just make one "step" or tick/update to the tweens progress, and if possible, pass in an update delta time.

I know that I can get a tweens duration, and a currentProgress value between 0 and 1, but how do I get the value of one "tick" to pass to the currentProgress?


Actually, I think I may have worked it out while trying to explain, Ill post back once I get something figured out.

Link to comment
Share on other sites

* currentProgress (0-1) is only available in a TimelineLite/Max. TweenLite/Max has currentTime, and this is expressed in either seconds or frames.


If you are using a seconds based tween (default):.

var currentFPS:Number = 30;
var nextTick:number = myTween.currentTime+(1/currentFPS);
myTween.currentTime = nextTick; // increases by 1 'tick' (hard jump), OR
TweenMax.to( myTween, (1/currentFPS), { currentTime:nextTick } ); // tweens to the next 'tick' (smooth, but delayed by 1 frame)


If you use frames in the tween (useframes:true), one 'tick' would be one frame:.

var nextTick:number = myTween.currentTime+1;


If you tween a tween's currentTime, you can have smooth 30+fps animation, while only calculating at 10 'tick's per second or something.


I hope that's helpful? Have a look at TweenLite/Max in the API, and click 'Show Inherited Public Properties' and 'Show Inherited Public Methods'. You will see the properties and methods of TweenCore then, which will show you everything they have available.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.