Jump to content
Search Community

Calculating change for throwprops.to ?

bonometric test
Moderator Tag

Recommended Posts

Hi, I've been trying to find a way to predict where throwprops tween will finally land (absolutely stops):

 

  1. I did my own  velocity detection via ThrowPropsPlugin.track(...)
  2. at touch-up event, i run something like :
    ThrowPropsPlugin.to(target, { throwProps:x:{velocity:1200,min:0,max:800}})
  3. I need to do something based on whether 'target' x final resting position is within certain value.

 

Is there simple way to do this ? I looked at the .calculateChange() but that seems to require .calculateDuration() first, and I was not sure using those two is the right thing to do or will yield the best/accurate result...

 

Thanks!

Link to comment
Share on other sites

A simple way to get the end value is like this

//create the tween just like you have been but with a reference
var myTween = ThrowPropsPlugin.to(target, { throwProps:x:{velocity:1200,min:0,max:800}});
//advance it to its complete state
myTween.progress(1);

trace(target.x) // and run other logic

//play the tween from the beginning
tween.restart();
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...