Jump to content
GreenSock

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

Resetting snap end value when using Draggable

Recommended Posts

Hi

 

I'm using the Draggable Util to create a spinning wheel, and using the throwProps:true property. When I listen for the snap function, the endValue is being incremented for each spin of my wheel. Is there a way to reset this after each spin?

 

Thanks

Dan

Link to comment
Share on other sites

Hi Diaco

 

Here you go - 

See the Pen MYNdWa by danrostron (@danrostron) on CodePen

.

 

If you spin the Throw me box, you will see 'endValue' being logged in the console. Every time you spin, the value is being incremented. I need to somehow reset this value after the spin is complete. Currently, the only way I can think to do this, is by recording the history in a seperate var and deducting this off the new endValue every time a spin occurs.

 

I just wondered if there was a better solution than this?

 

Thanks

Dan

Link to comment
Share on other sites

pls try this :

console.log('endValue: '+endValue%360)
Link to comment
Share on other sites

Yes, that works and makes perfect sense. Thanks ever so much for your help.

 

Dan

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