Jump to content
GreenSock

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

Alternating tweens

Recommended Posts

Hello

 

I want to animate a movieclip, this movieclip will animate when I click it.

 

button.addEventListener(MouseEvent.MOUSE_DOWN, pickup);

function pickup(event:MouseEvent):void  
{ 
  button.startDrag();
  TweenLite.to(button, .3, {scaleX:1, scaleY:1});
}

 

So when button is clicked, it starts being dragged. What I want now is for it to rotate 60 degrees to the left, then to the right, then the left and so on, alternating between the two till I release my mouse.

 

What I would normally do is call a function that spins it one way, then onComplete call the other function to spin it the other way with another onComplete calling the first function again.

 

Is there a way to do this in a single line using Tweenlite? Kind of like how you would do it using timelinemax - but not.

 

Thanks

Link to comment
Share on other sites

Nobody ever needs to do this?

Link to comment
Share on other sites

Is there some reason you don't want to use TimelineMax? It'd make things simpler, although it's not really necessary I suppose.

 

Your idea with the onComplete(s) sounds fine - is there a reason you don't want to do that?

 

If you want a tween to repeat, going backwards and forwards over and over again, you could use TweenMax and set repeat:-1, yoyo:true but it sounds like you're trying to create two different tweens altogether (different end values) so that won't apply here.

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