Jump to content
GreenSock

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

ThrowPropsPlugin completeTween?

Recommended Posts

Hi 

I'm using ThrowPropsPlugin to animate a sprite called imageContainer:

 

The code I'm using is from the ThrowPropsPlugin  example found here: http://www.greensock.com/throwprops/

 

Example: 

ThrowPropsPlugin.to(imageContainer, {throwProps:{
y:{velocity:yVelocity, max:maskBounds.top, min:maskBounds.top - yOverlap, resistance:300},
x:{velocity:xVelocity, max:maskBounds.left, min:maskBounds.left - xOverlap, resistance:300}
}, onUpdate:scrollUpdate, onComplete:scrollEnd, ease:Strong.easeOut
}, 10, 0.3, 0);

 

Is there a method I can call on TweenLite that forces the animation to end instantly but still places my imageContainer where it was heading within the bounds? 
 
Any help appreciated!
 
Thanks
 
Rolf 
 
 
 
 
 
Link to post
Share on other sites

Hi Rolf,

 

Welcome to the GreenSock forums.

 

Yes, ThrowPropsPlugin.to() returns a TweenLite instance

 


to () method
public static function to(target:Object, vars:Object, maxDuration:Number = 100, minDuration:Number = 0.25, overshootTolerance:Number = 1):TweenLite

 

 

So in your case you should be able to just create a reference to your tween like so

var throwTween = ThrowPropsPlugin.to(imageContainer, {throwProps:{y:{velocity:yVelocity, max:maskBounds.top, min:maskBounds.top - yOverlap, resistance:300},
x:{velocity:xVelocity, max:maskBounds.left, min:maskBounds.left - xOverlap, resistance:300}
}, onUpdate:scrollUpdate, onComplete:scrollEnd, ease:Strong.easeOut
}, 10, 0.3, 0);

and then later if you want to force that tween to finish

throwTween.progress(1);

Let us know if you need more help

  • Like 1
Link to post
Share on other sites

Hi Carl

It worked perfectly  8-)

Thanks, much appreciated!

Rolf 

  • Like 1
Link to post
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.

×