alexb148 Posted September 18, 2023 Share Posted September 18, 2023 I'm using Draggable with the Inertia plugin to create a wheel that can be spun by the user. It's all working fine and does what I expect... until it doesn't. Sometimes I spin, and just get the console error "Not tracking velocity of rotation." Searching hasn't yielded any info on what this error means. There doesn't seem to be any pattern to when it doesn't work - it just sometimes doesn't, for whatever reason. Is anyone able to shed any light on what could cause this error, or how I can debug it further? Thanks! Link to comment Share on other sites More sharing options...
Rodrigo Posted September 18, 2023 Share Posted September 18, 2023 Hi, Sorry to hear about the troubles, but there isn't a lot we can do without a minimal demo that reproduces the error you're seeing. The only thing I can think of is that you're not using the latest version of GSAP, Draggable and Inertia or that you're using different versions. Finally the issue seems to stem from something in your Spinner.js file, basically in the onDragEnd callback, but like I said without a demo, I'm basically guessing blindly here. Happy Tweening! Link to comment Share on other sites More sharing options...
alexb148 Posted September 18, 2023 Author Share Posted September 18, 2023 Thanks - your message helped me figure out a silly mistake. My onDragEnd function was simply: const onDragEnd = (e) => { const velocity = InertiaPlugin.getVelocity(e.target, 'rotation'); } The issue was that depending on where my swipe ended, e.target was not always the element with Draggable applied. Which explains the seemingly random nature of the issue. 1 Link to comment Share on other sites More sharing options...
Rodrigo Posted September 18, 2023 Share Posted September 18, 2023 Hi, A solution is to use an anonymous function where this is the Draggable instance: onDragEnd: function() { InertiaPlugin.getVelocity(this.target, "rotation"); } Like that, regardless of where the pointer is when the Drag End event is called, the target will always be the Draggable's instance target. Hopefully this helps. Happy Tweening! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now