Returns : Tween
A tween instance (with a duration of 0) which can optionally be inserted into a timeline instance (although it’s typically more concise to just use the timeline’s set()
method).
Details
Immediately sets properties of the target accordingly - essentially a zero-duration to() tween with a more intuitive name. So the following lines produce identical results:
gsap.set(myObject, {x: 100, y: 50, opacity: 0});
gsap.to(myObject, {duration: 0, x: 100, y: 50, opacity: 0});
And of course you can use an array to set the properties of multiple targets at the same time, like:
gsap.set([obj1, obj2, obj3], {x: 100, y: 50, opacity: 0});
You can also use selector text to target DOM elements that match that criteria.