SpaceMoney-01011000 Posted August 19, 2022 Share Posted August 19, 2022 I keep coming across this term in the GSAP literature, but I'm confused as to what it means, or what it is. Is this nomenclature specific to GSAP? I can't find any information about it outside of the official documentation. In which context is it being used in reference to GSAP? Link to comment Share on other sites More sharing options...
Carl Posted August 20, 2022 Share Posted August 20, 2022 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 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 3 Link to comment Share on other sites More sharing options...
Cassie Posted August 20, 2022 Share Posted August 20, 2022 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. ☺️ 3 Link to comment Share on other sites More sharing options...
SpaceMoney-01011000 Posted August 20, 2022 Author Share Posted August 20, 2022 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 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. Good to know! Thanks so much guys! 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