Jump to content
Search Community

yafitohana

Members
  • Posts

    2
  • Joined

  • Last visited

yafitohana's Achievements

1

Reputation

  1. Thank you so much that's exactly what I needed. couldn't find it in the docs. You're awesome!!!
  2. Hey, Been using GSAP for a while now, but I have a problem with the snap feature of ThrowPropsPlugin. I'm currently working on a project that includes pixi.js and I'm using GSAP to animate. since I'm using pixi and not regular html elements I decided to use ThrowProps directly and not draggable. here's a snippet: this.tween = ThrowPropsPlugin.to(this, { throwProps: { x: { velocity: 'auto', min: 0, max: 1000, end: function (naturalStop) { if (distanceFromAnotherPixiObject < 50) { return anotherPixiObject.x } return naturalStop } }, y: { velocity: 'auto', min: 0, max: 1000, end: function (naturalStop) { if (distanceFromAnotherPixiObject < 50) { return anotherPixiObject.x } return naturalStop } } }, onComplete: () => { delete this.tween } }, 1, 0, 0.4) that code is executed with the event pointerOut and "this" is the pixi object the problem I'm having is that in order to calculate the distance between the 2 objects I need to have both x and y in the end function.. the behaviour I'm trying to do is to snap to an object if the dragged object is close enough.. really need your help with this one, been struggling for a while now thanks in advance
×
×
  • Create New...