loll Posted July 11, 2020 Share Posted July 11, 2020 I am new to Greensock. I am using draggable to drag items around the screen im using hit test to determine if the item drops in a place that is allowed. When its not in a place that is allowed, I am wanting the object to return to where it came from using "onPress" I am getting the original x and y but im not sure how to move it back there. how is it best to ping the div back to the original place it came from? Link to comment Share on other sites More sharing options...
loll Posted July 12, 2020 Author Share Posted July 12, 2020 I have figured this out: TweenLite.to(this.target, 0.5, {x: boxX +"px", y: boxY +"px", ease: Bounce.easeOut}); Link to comment Share on other sites More sharing options...
GreenSock Posted July 12, 2020 Share Posted July 12, 2020 Are you using GSAP 3? I'd highly recommend it. Smaller, more features, simpler API. You could simplify your code to: gsap.to(this.target, {x: boxX, y: boxY, ease: "bounce"}); Happy tweening! 2 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