Jump to content
Search Community

Draggable Queen

SpiritedMan test
Moderator Tag

Recommended Posts

Hi,

 

I don't have time right now to go into this, but you can definitely try the hitTest method in Draggable:

https://gsap.com/docs/v3/Plugins/Draggable/static.hitTest()

 

Based on that you can set the final position of the element using the onDragEnd callback:

Draggable.create(knight, {
  onDragEnd() {
    // Run hit test logic here using this.hitTest()
    // Then use a set() instance
    gsap.set(knight, {
      x: 0, // calculated value
      y: 0, // calculated value
    });
  },
});

Hopefully this helps.

Happy Tweening!

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