Jump to content
Search Community

Draggable with multiple triggers?

mallanaga test
Moderator Tag

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

If I create 2 draggables on an object, only the last one sticks. Any way to have multiple triggers on the same object?

 

The example I have here is a card of sorts. I'd like to be able to:

  • move the card when when clicking in the middle and dragging
  • flip the card when clicking in the middle
  • rotate the card when clicking the corners and dragging
  • flip the card when clicking an edge and dragging into the card

Am I declaring the draggables wrong? Is there a different way to use triggers? Thanks!

See the Pen JdKXgq by anon (@anon) on CodePen

Link to comment
Share on other sites

Wow... I wasn't even close! That clears it up and really shows the code shining. Thanks! You just got yourself a club member =)

 

I lied on marking as solved...  How would you handle multiple entities? I added a few elements and it's pretty funky. Several end up moving simultaneously.

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