Jump to content
GreenSock

boy2k

Throwprops end not working with negative numbers.

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi all,

im having an issue with Throwprops where the end: value will not work unless it is a posative number. I am doing a simple y tween but it always defaults any negative number to 0 instead.

my code:

var maxY = 215;
var minY = maxY - ((targContainer.getNumChildren()-1) * this.stakeNumYSpacer);
// get the current velocity
var vY = this.Ytracker.getVelocity("y");

// get available end points
var endArr = new Array();
for( var i=0; i < targContainer.getNumChildren(); i++) {
  endArr.push(maxY - (i*this.stakeNumYSpacer));
} // tween flick
ThrowPropsPlugin.to( targContainer, {throwProps:{y:{velocity:vY, max:1000, min:0, end:endArr}}, ease:Strong.easeOut}, 2, 0.2, 0.6);

This is a log of the array i am passing

endArr:215,172,129,86,43,0,-43,-86,-129,-172,-215,-258,-301,-344,-387,-430,-473,-516,-559,-602,-645,-688,-731,-774,-817

Any ideas what i am doing wrong?

edit: I'm using CreateJS if that comes into the equation? Shouldn't think so because its just a numerical value but for info purposes...

 

Link to comment
Share on other sites

Hi,

 

Since you are setting a min value of 0, the end position can never be less than that

 

ThrowPropsPlugin.to( targContainer, {throwProps:{y:{velocity:vY, max:1000, min:0, end:endArr}}, ease:Strong.easeOut}, 2, 0.2, 0.6);

Link to comment
Share on other sites

DOH!!! haha 

I throught the min/max were to control the velocity speed... /facepalm...

thank you Carl :)

Link to comment
Share on other sites

No worries. It can certainly take a little time to get familiar with all the features and flexibility of ThrowProps.

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