Jump to content
Search Community

Ease out looping tween on the fly

redordead test
Moderator Tag

Recommended Posts

Hi

 

I'm new to Tweenlite, have a query that may be very simple.

 

I have a tween thats repeating an object being rotated 360degrees, I want to update the tween so it eases out to a new degree requirement e.g.

 

from...

thisTween = new TweenMax(rec, 4, {rotation:"360",  ease:Linear.easeNone, repeat:-1 });

 

to 

{rotation:"25",  ease:Linear.easeNone, repeat:0 });

 

so it basically eases the objects rotation, stopping at 25 degrees.  Spent the last hour trying to solve this, nothing so far.  Any help greatly appreciated.

 

Many thanks.

            
Link to comment
Share on other sites

This is EXACTLY the kind of thing that ThrowPropsPlugin is for - it allows you to feed in a velocity for a property (in this case "rotation") and then it will figure out how far that value should go based on a bunch of factors (like the duration of the tween, the ease, and any max/min values you provide) and then do the animation for you so that it looks seamless. 

 

More info is at http://www.greensock.com/throwprops/

 

In your case, the velocity would be 90 because you're going 360 over the course of 4 seconds (360 / 4 = 90 units per second). So your tween could look like: 

 

TweenLite.to(rec, 2, {throwProps:{rotation:90}});

And you can get more complex if you want to feed in resistance values or min/max values, etc. Let me know if you need any help with those. 

 

Note: ThrowPropsPlugin is a membership benefit of Club GreenSock ("Shockingly Green" and "Business Green" levels). Learn more at http://www.greensock.com/club/

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.
×
×
  • Create New...