Jump to content
GreenSock

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

stop and rewind tweens to a certain frame?

Recommended Posts

Hi,

 

I have a file that does not use timelineLite or Max. Just straightforward series of TweenMax tweens with delays.

 

I have a button and I want to stop all animations where they are and just reset them to the beginning of that frame.

 

I see there is a rewind feature and killTweens feature, but rewind speaks specifically to timelineMax, and killTweens may or may not rewind? When I read the docs, it seems to really only say that killTweens works on specific movie clips, but want to stop and rewind.

 

Is there a way to do this or a tutorial on this, where it's not actually in a timeline variable?

 

thanks,

 

Dave

Link to comment
Share on other sites

Hi Dave,

It sounds like it would be much easier in the long run to convert the animation to TimelineLite/Max to achieve what you want.

 

However, I do have a question as you say the animation is built with TweenMax, however later you mention resetting them back to the beggining of the frame - so is it a timeline based animation or purely TweenMax?

 

If it's built entirely in TweenMax with delayed calls, then one way to do it is to put all your tweens into a function, then call that function with your button.

You may also need to create a 'reset' function that would put all the tweens back to their original values first.

 

I hope that helps, I don't have time at the moment to write some example code, but if you run into problems post back. Jack or Carl may be able to provide more insight though.

 

X10

Link to comment
Share on other sites

my problem with that is I have varying tweens that coordinate to a narration. I have only found timeline to work with even frames.

 

I'm sure it's possible to re-code all this, but I'm hoping there is just something I can add to the button function, similar to stop all sounds that would simply stop and rewind the tween to a certain frame. Is there something like this? That would save me hours of figuring out how to do this using timelineMax.

 

thanks,

Dave

Link to comment
Share on other sites

I'm having difficulty visualizing what you want to do or how your file is set up.

 

 

I want to stop all animations where they are and just reset them to the beginning of that frame

 

rewind the tween to a certain frame

 

 

I think i'm having trouble understanding what frame means.

 

Are you using frames as a tween duration as opposed to seconds with useFrames:true?

 

Do you have a long Flash timeline with tweens on different frames of the timeline?

 

Are you using the frame or frameLabel plugins to tween to a certain frame of a movie clip?

 

TweenMax/lite tweens can easily be reversed with:

 

var someTween:TweenMax = TweenMax.to(mc, 1, {x:200});

//animate in reverse 
someTween.reverse();

or to jump back to the beginning

someTween.currentProgress = 0;

 

so as long as all your tweens are named with var syntax above, you can get them to play backwards or jump to their beginning.

 

also you could use getAllTweens() http://www.greensock.com/as/docs/tween/ ... AllTweens()

and loop through all the tweens in your file and perhaps just rewind ones that have a delay greater than a certain value.

so you could say "if a tween had a delay of more than 20 seconds... reverse() it"

 

without knowing more about the structure of your document it is difficult to really advise what to do. my gut feeling is that TimelineLite/Max have plenty of basic features that would make something like this much easier. If you are ever sequencing more than 3 tweens, you really should be using them. just my 2 cents.

 

c

Link to comment
Share on other sites

as far as frames are concerned, it would be a button that I am sending to frame 5... so as shown in my screensthot, I have buttons set to play different animations starting at different frames, so that I can keep my tweens separate?

 

post-6318-133152003455_thumb.jpg

 

and then in this, you can see on the line above, I have my button scripts. I'm trying to keep everything somewhat separate to make it easier to go back and update tweens.

 

post-6318-133152003472_thumb.jpg

 

THANKS!!

Dave

Link to comment
Share on other sites

I really don't have a solution for what you want to do.

 

perhaps you can create functions on each frame that set all the objects back to their "orginal positions / settings" and a function that creates a series of tweens.

 

something like

 

function init(){
 TweenMax.killAll();
 mc.x = 100;
 txt.y = 200;
}

function runTweens(){
 TweenMax.to( mc, 1, {x:0});
 TweenMax.to( txt, 1, {y:200});

}

 

and then if you want to reset the tweens you just call init().

if you want to replay the tweens call init() and runTweens().

Link to comment
Share on other sites

ok, well I'm going to spend the morning watching your timeline vids. Hopefully that points me in the right direction.

 

thanks

Dave

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.
×