svetlana Posted January 28, 2021 Share Posted January 28, 2021 Hello. I'm trying Draggable and Snap functional but I see that transformed elements snap by original coordinates x, y instead of transformed x, y. Can Draggable and Snap works with transformed x, y (vertices)? Thanks See the Pen GRNKPvz by svetlanata (@svetlanata) on CodePen Link to comment Share on other sites More sharing options...
ZachSaucier Posted January 28, 2021 Share Posted January 28, 2021 Hey svetlana and welcome to the GreenSock forums. Two things related to this: We recommend always using GSAP to set the transforms of elements that you're animating with GSAP. Not doing so is one of the most common GSAP mistakes. I would probably apply the transformation on elements that are not related to the snapping. So if you need to transform the container, create a wrapper element around it that you transform instead. If you need to transform the content (elements snapping), create an element that goes within the element that's getting snapped that you transform. Does that make sense? 1 Link to comment Share on other sites More sharing options...
GreenSock Posted January 28, 2021 Share Posted January 28, 2021 Or you could use your own custom snapping function to run whatever logic you want in there. If necessary, you could use the MotionPathPlugin.convertCoordinates() to convert coordinates. 2 Link to comment Share on other sites More sharing options...
svetlana Posted January 29, 2021 Author Share Posted January 29, 2021 21 hours ago, GreenSock said: Or you could use your own custom snapping function to run whatever logic you want in there. If necessary, you could use the MotionPathPlugin.convertCoordinates() to convert coordinates. Thanks. MotionPathPlugin is amazing tool! I'll try it. 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