PDA

View Full Version : Rewind Tween



thesprucegoose
August 20th, 2009, 10:29 AM
Hello,

I'm attempting to make a rewind function, but have no idea where to start.

I have a movie that spans over 60 frames and rotates. I would like the user to be able to click a button and make the movie rewind and tween to go to that frame.

For example, if the movie is on frame 55 and the user clicks a button, I want to movie to tween backwards (frame 54, frame 53, frame 52, etc etc) until it gets to frame 45.

How would I go about doing this?

Thanks!

--thesprucegoose

FNfG
August 20th, 2009, 10:52 AM
Hello,

I'm attempting to make a rewind function, but have no idea where to start....

How would I go about doing this?
Look into TweenLite and TweenMax (http://blog.greensock.com/).

daidai
August 20th, 2009, 10:55 AM
check out BetweenAs3 as well

http://www.be-interactive.org/works/20090428/slide_betweenas3.html

excogitator
August 20th, 2009, 11:13 AM
If the animation is hardcoded on your timeline since you say frames, you can use a setInterval function to execute n number of times and go prevframe until it reaches frame 45.

greensock
August 21st, 2009, 10:12 AM
In TweenMax v11 or later...


var destinationFrame:uint = 45; //or whatever
var duration:uint = Math.abs(mc.currentFrame - destinationFrame); //duration in frames
TweenMax.to(mc, duration, {frame:destinationFrame, ease:Linear.easeNone, useFrames:true});

It's even easier if you want to do the tween in a certain amount of time (in seconds), and you can even ease the whole thing too...


TweenMax.to(mc, 1, {frame:45}); //eases to frame 45 over the course of 1 second using the default ease (Quad.easeOut)

You can do it with TweenLite too if you prefer. Just don't forget to activate the FramePlugin first. You can also tween to a particular frame label, like TweenMax.to(mc, 1, {frameLabel:"myLabel'});

Another thing to point out about rewinding is that TweenMax has a reverse() method that makes it super easy to make a tween go backwards from wherever it happens to be, so if you call myTween.reverse() when it's mid-tween, it'll smoothly go backward to the beginning. And there are brand new TimelineLite and TimelineMax classes that allow you to set up a sequence of tweens and control them as a whole. You can call reverse() on a TimelineLite/Max to reverse the whole sequence. You can alter the timeScale to slow things down or speed it up, and you can even tween the time property to fastforward/rewind.

http://blog.greensock.com/v11beta/