Jump to content
GreenSock

Joe Hakooz

Draggable isThrowing - undefined

Go to solution Solved by Diaco,

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

  • Solution

Hi Joe Hakooz :)

 

pls be sure that using last version of GSAP ( 1.17.0 )

 

pls check this out : 

See the Pen yNvEgY by MAW (@MAW) on CodePen

Link to comment
Share on other sites

Yep. Updated to latest version and it works. Thanks!

Link to comment
Share on other sites

Spoke too soon. Looks like there's a possible bug. 

 

Using your codepen, throw the ball. Then click on the ball without dragging. Notice how it is returning true for each of the properties. Eventually it stops doing that, but I'm not sure how, when, or why. 

 

Is this a bug? The reason it matters is because I'm trying to allow a "mouseup" event ONLY when the draggable is not dragging or throwing. 

 

Thoughts?

Link to comment
Share on other sites

i see... , but that's not a bug ! :)

 

in fact with  ' x,y ' we use subpixels not pixels and when you click without any drag that snap to nearest pixel , pls add something like this to your draggable creation to snap pixel perfect position on throwComplete :

snap:{
  x: function(endValue) { return endValue.toFixed(0) },
  y: function(endValue) { return endValue.toFixed(0) }
}

See the Pen yNvEgY by MAW (@MAW) on CodePen

 

  • Like 1
Link to comment
Share on other sites

Interesting.

 

Works great in your demo but in my actual project, throwing now gives a funky rubber band feel.

My actual implementation is more complex than a single ball. I'm using a bunch of "cards" that dynamically move around to create infinite scrolling. 

 

I'll need to play around a bit on my end and see what I get. 

Thanks for your help!

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