Jump to content
GreenSock

TweenLite.set()

TweenLite.set( target:Object, vars:Object ) : TweenLite

[static] Immediately sets properties of the target accordingly - essentially a zero-duration to() tween with a more intuitive name.

Parameters

target: Object

Target object (or array of objects or selector text) whose properties will be affected.

vars: Object

An object defining the value for each property that should be set. For example, to set mc.x to 100 and mc.y to 200, do this: TweenLite.set(mc, {x:100, y:200});  You may also define any of the special properties baked into GSAP like delay, onComplete, etc.

Show More

Returns : TweenLite

A TweenLite instance (with a duration of 0) which can optionally be inserted into a TimelineLite/Max 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:

TweenLite.set(element, {x:100, y:50, opacity:0});
TweenLite.to(element, 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:

TweenLite.set([obj1, obj2, obj3], {x:100, y:50, opacity:0});

Or use selector text to target DOM elements that match that criteria.

Copyright 2017, GreenSock. All rights reserved. This work is subject to theterms of useor for Club GreenSock members, the software agreement that was issued with the membership.
×