Jump to content
Search Community

fionchadd

Premium
  • Posts

    29
  • Joined

  • Last visited

Everything posted by fionchadd

  1. Hi OSUblake, Thank-you so much, this is *perfect*! And so much simpler than what I was trying to do. Thanks for the heads-up on getProperty as well! I'm very grateful Hannah
  2. Hi there, I'm trying to give my tortoise a hat using Draggable and I'm really struggling to get the behaviour I want. The ideal behaviour is that if the hat overlaps the dropzone (outlined in red) when the user releases the mouse, it snaps to the center of the dropzone. Otherwise it falls to the ground. Falling to the ground is working fine, but I can't get it to snap to the center of the dropzone. I found a few codepens / threads on the forums with similar requests, but they either use a left/top drag or absolute positioning; my elements are part of an SVG so I'm unable to use those methods. What I'm doing at the moment is getting the left and top position of the dropzone, then on drag end getting the left and top position of the hat, the distance between that and the dropzone, and the current X and Y values of the hat. Then I'm adding half of the distance to the current X and Y values and tweening to that. It seems to get fairly close on certain screen sizes, but it doesn't seem to be a responsive solution and although it is tweening, it doesn't seem to be tweening to the exact center of the dropzone. I realise this isn't really a "how do I use draggable" question so I totally understand if it's beyond the scope of support that you offer, but if you have any similar examples you can point me towards I'd be very grateful! Hannah
  3. Hi Jack, ah that’s amazing, thanks so much for the advice! I’m still pretty new to gsap so that’s super helpful to know. Also cant believe I found a real life bug lol, I was convinced I was doing something wrong ? thanks for your help! hannah
  4. Hi there, I'm trying to work with Draggable at the moment and I'm having an issue with the snap function. I'm trying to get the item to return to its original position after it's been thrown; currently the snap value seems to be affecting the X value but not the Y value and I'm not really sure why? Any advice you can give would be greatly appreciated! Thanks Hannah
×
×
  • Create New...