Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Ron Itelman

Reducing the time it takes for Draggable throwComplete property

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

Currently I have a draggable item that alters the item beneath it when hitTest is true. I use 'throwComplete' because using onDragEnd sometime triggers both the element the item originated on AND the item the draggable ends up on (I'm using snap). I only want the element that the draggable element will end up on, and throwComplete works correctly for this. However, it takes about .5 of a second for the throwComplete to be triggered. I tried 'autoScroll: 2', but that didn't seem to make a difference. Any tips?

 

Thanks! 

Link to comment
Share on other sites

I'm not sure I completely understand the question. You're throwing an element and using hitTest, but also talking about autoScroll? We can better assist you with a demo. Here's some more info about creating one.

 

Thanks and happy tweening.

:)

 

  • Like 1
Link to comment
Share on other sites

You can change maxDuration and minDuration while defining the Draggable or you can change it on the fly. You can also perform tests on distance between object and target location inside snap function to set the maxDuration.

 

https://greensock.com/docs/Utilities/Draggable Read 'throwProps' under Config object properties

 

In following demo I am changing minDuration to demonstrate.

 

See the Pen xJqway?editors=0010 by Sahil89 (@Sahil89) on CodePen

 

  • Like 5
Link to comment
Share on other sites

Thanks @Sahil - maxDuration did the trick!

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