Jump to content
Search Community

How to get gsap's target object?

Paul123 test
Moderator Tag

Recommended Posts

Hi Guys!

 

Is there a way in GSAP3 to retrieve the target object of a tween?

example:
 

gsap.to('.selector', { duration: 1, y: theTarget.offsetHeight} )

If I remember correcty, there is a utility function in GSAP that retrieves the target DOM. That way you don't have to type the selector again.

 

Thank You!!

Link to comment
Share on other sites

Thank You! I didn't thought of that one! Will def go with this route!


PS:
But yeah, I remember GSAP having a way of accessing the target object - it's something that's not in the docs i think. If I'm not mistaken, I used "it" when I was working with GSAP Draggable. It's like a shortcut or something 😅

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