Jump to content
GreenSock

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

Draggable "throwResistance" property not respected

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

Hello!

 

I'm trying to slow down the item faster after mouse release on drag, but it seems that using any number for the throwResistance variable makes no change to the functionality. 

 

Here is the example: https://jsfiddle.net/annam/zypagaLe/1/

 

Am I wrong in assuming that changing the throwResistance property would affect the speed in which the dragged item would decelerate? If so, what exactly does the throwResistance accomplish?

 

Thanks,

Anna

See the Pen 1 by annam (@annam) on CodePen

Link to comment
Share on other sites

UPDATE: it seems that this is affected by the "bounds" property? as soon as I remove the bounds setting the difference between the two items' friction in the example is visible..

 

https://jsfiddle.net/annam/zypagaLe/2/

 

why is that?

Link to comment
Share on other sites

UPDATE 2: it seems that the bounds was affecting it because the bounds were too small for the deceleration to show... increasing the bounds kind of shows a difference in the friction, however it's minimal even if we set the throwResistance setting to be ridiculously high.. is this normal?

 

try "flicking" the boxes to the right.. we would expect the second box to slow down immediately, have no momentum at all with such a high resistance value.. this is what we are trying to achieve 

 

https://jsfiddle.net/annam/zypagaLe/3/

Link to comment
Share on other sites

Sorry about the confusion - the issue is just that there's a default minimum duration applied to the throwProps stuff of 0.5 seconds. You can change that by either setting it directly in your Draggable, like:

Draggable.create('#box2', {
  throwProps: true,
  throwResistance: 999999,
  minDuration:0
});

Or you could set overshootTolerance:0. Either one should work. 

 

Does that resolve things for you? 

Link to comment
Share on other sites

Hi Jack, thanks for this info, yes this did the trick!

 

we were actually using maxDuration: 0 trying to limit this and we hadn't noticed that there was also a minDuration setting.

 

thanks again!

 

Anna

  • Like 1
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.
×