Jump to content
Search Community

How to Drag & Toss Elements Between Two Rotating Containers?

Eunomiac test
Moderator Tag

Recommended Posts

I have a variable number of rotating circles (though the demo only includes two), each of which contain several Draggable dice in "orbit" around the circles' centers.

 

I want to be able to drag and toss (with inertia) the dice from one circle to another, and have them snap into orbit when they arrive.

 

But, try as I might, I can't figure out how to get the snapping to work accurately!

 

I've commented up (hopefully without too much rambling; I have been known to go on... kind of like I'm doing here...) a mini demo per the forum instructions that should clearly illustrate my problem.  The first fifty lines or so are setup and initialization, which I've done my best to collect into a closure (so you can "Fold All" everything to jump to the Draggable code, where I'm pretty sure I've made my mistakes).

 

Any help is, once again, very much appreciated!

 

(PS: I've also noticed that my dice are ever-so-slightly offset from the dashed rings they should be orbiting on.  I'm not sure if this is a GSAP issue or something unrelated, but if it's the former, I'd really appreciate some insight into that minor issue, too!)

See the Pen powBpLa by eunomiac (@eunomiac) on CodePen

Link to comment
Share on other sites

Looks like a fun challenge, @Eunomiac. And thanks for creating a minimal demo. It's way beyond the scope of the help we offer for free in these forums (please see the forum guidelines) because this is all about complex logic issues rather than a GSAP-specific question. If you've got any of those, though, we'd be happy to help. If you'd like to explore paid consulting options, we can certainly connect privately about that because we always try to make sure our users get the help they need.

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