Jump to content
Search Community

Vars?

SpaceMoney-01011000 test
Moderator Tag

Recommended Posts

For a little walk down memory lane... the vars object goes all the way back to the ActionScript 2 version of GSAP as you can see in the source code here.

 

If one were to dig into the ActionScript 3 documentation you could find note of it here.

 

Being that GreenSock had loads of faithful Flash users and a proven API, much of what was available in the Flash days made it over into the JS version and is still around today although version 3 was a major overhaul which greatly trimmed a lot of fat. 

 

Since the vars term was so grounded in the history of the API it kind of stuck around for awhile. I believe some folks prefer the term config object.

 

However, the documentation for gsap.to() pretty much sums it up 

 

  1. vars - an object containing all the properties/values you want to animate, along with any special properties like ease, duration, delay, or onComplete (listed below). 

 

basically the vars object has all the stuff in bold below

 

gsap.to(obj, {x:300, y:200, delay:2, repeat:3, onComplete:done})

 

Hopefully this helps

  • Like 3
Link to comment
Share on other sites

9 hours ago, Cassie said:

Also - a little more zoomed out.  'vars' is short for variables. This is true across JS in general.

 

i.e the variables object, an object containing variables that affect the animation. ☺️

 

15 hours ago, Carl said:

For a little walk down memory lane... the vars object goes all the way back to the ActionScript 2 version of GSAP as you can see in the source code here.

 

If one were to dig into the ActionScript 3 documentation you could find note of it here.

 

Being that GreenSock had loads of faithful Flash users and a proven API, much of what was available in the Flash days made it over into the JS version and is still around today although version 3 was a major overhaul which greatly trimmed a lot of fat. 

 

Since the vars term was so grounded in the history of the API it kind of stuck around for awhile. I believe some folks prefer the term config object.

 

However, the documentation for gsap.to() pretty much sums it up 

 

  1. vars - an object containing all the properties/values you want to animate, along with any special properties like ease, duration, delay, or onComplete (listed below). 

 

basically the vars object has all the stuff in bold below

 

gsap.to(obj, {x:300, y:200, delay:2, repeat:3, onComplete:done})

 

Hopefully this helps



Okay, now I get it!

The .to() method of the gsap object can have parameters passed in, as an object - denoted by the curly braces, and the key/value pairs - which is the vars object

Or, something like that. :D 

Good to know! Thanks so much guys!
 

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