Jump to content
Search Community

In the method gsap.to(t,e,r) what is r?

Aimack test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

I am a js newbie and I understand that t is the target and e is the event property of the method gsap.to. 

Not sure what the property r is here. 

Also, I was trying to see the actual code for gsap.to method but couldn't find it. How do I get that? Just trying to understand how it works under the hood.

Screenshot 2023-01-14 082418.jpg

Link to comment
Share on other sites

  • Solution

Hi @Aimack. Yes, the first parameter is the target and the 2nd parameter is the vars object with all the configuration details. The 3rd isn't typically used - that's only there for legacy reasons (if someone uses the OLD syntax where the 2nd parameter was actually the duration and the 3rd was vars). 

 

I'd strongly recommend reading this: 

 

And also: https://greensock.com/docs/v3/GSAP/Tween

 

There is no "event" property, just so you know. 

 

As for looking at the raw code, it's all in the download zip or you can go to the github repository here: https://github.com/greensock/GSAP/blob/master/src/gsap-core.js

 

But if you're new to JavaScript, I don't think it'll be helpful to look at the source code. It'll probably totally confuse or overwhelm you. GSAP is written to be optimized for performance, not readability in the code. 

 

Enjoy the tools and good luck on your learning adventure. 👍

  • Like 2
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...