sv en en en en en en en en en en en en en en en fa en en fr hbs_lat en en en es en en en de en en fr en en ca en en en en en en ca sv en en pl pl sv en en en it uk ky en en ru ru az de de fa de mn uk az en en en it ar tg ru en es tr it en mr ru el ceb fa tr ko en en ar tr hbs_lat de en en fi fa ru de myv fi ru da fr eu ja en ru fr en kn ko en en en en hu en en en hi en en en en en en sv en sv en ru en sv en nl en en en en en ca en en en de en en en es en en en en en en en de en it en en en en en en en fr cv es tr es en en en en ms en en en en en en fr en hbs_lat en en en en en en en fr cv es tr es en en en en de en en en ca en en en en en
(default = +=0) — Controls the placement of the object in the timeline (by default, it’s the end of the timeline, like “+=0”). Use a number to indicate an absolute time in terms of seconds, or you can use a string with a “+=” or “-=” prefix to offset the insertion point relative to the END of the timeline. For example, "+=2" would place the object 2 seconds after the end, leaving a 2-second gap. "-=2" would create a 2-second overlap. You may also use a label like "myLabel" to have the object inserted exactly at the label or combine a label and a relative offset like "myLabel+=2" to insert the object 2 seconds after “myLabel” or "myLabel-=3" to insert it 3 seconds before “myLabel”. If you define a label that doesn’t exist yet, it will automatically be added to the end of the timeline before inserting the tween there which can be quite convenient.
Be sure to read our tutorial Understanding the Position Parameter which includes interactive timeline visualizations and a video.
(default = 0) — [only relevant when the first parameter, value, is an array] Staggers the inserted objects from the array that is being added by a set amount of time (in seconds). For example, if the stagger value is 0.5 and the "align" parameter is set to "start", the second one will start 0.5 seconds after the first one starts, then 0.5 seconds later the third one will start, etc. If the align property is "sequence", there would be 0.5 seconds added between each tween. Default is 0.
Adds a tween, timeline, callback, or label (or an array of them) to the timeline.
The position parameter gives you complete control over the insertion point. By default, it’s at the end of the timeline. Use a number to indicate an absolute time in terms of seconds (or frames for frames-based timelines), or you can use a string with a “+=” or “-=” prefix to offset the insertion point relative to the END of the timeline.
For example, "+=2" would place the object 2 seconds after the end, leaving a 2-second gap. "-=2" would create a 2-second overlap. You may also use a label like "myLabel" to have the object inserted exactly at the label or combine a label and a relative offset like "myLabel+=2" to insert the object 2 seconds after “myLabel” or "myLabel-=3" to insert it 3 seconds before “myLabel”. If you define a label that doesn’t exist yet, it will automatically be added to the end of the timeline before inserting the tween which can be quite convenient.
//add a tween to the end of the timeline
tl.add( gsap.to(element, {duration: 2, left: 100}) );
//add a callback at 1.5 seconds
//add a label 2 seconds after the end of the timeline (with a gap of 2 seconds)
//add another timeline at "myLabel"
//add an array of tweens 2 seconds after "myLabel"
tl.add([tween1, tween2, tween3], "myLabel+=2");
//add an array of tweens so that they are sequenced one-after-the-other with 0.5 seconds between them, starting 2 seconds after the end of the timeline
tl.add([tween1, tween2, tween3], "+=2", "sequence", 0.5);
Be sure to read our tutorial Understanding the Position Parameter which includes interactive timeline visualizations and a video.
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.
“GSAP was a revelation for me to be compared with the introduction of jQuery”
“There is no doubt that GreenSock is currently the best available tool for creating astonishing interactive websites and animation effects.”
“Performance has been of paramount importance for GreenSock, so there is always peace of mind for us, developers.”
“It's shocking the @w3c didn't use @greensock as a model of how to do animation via code. Did they even ask animators what they use?”
“@greensock is just pure awesomeness. What more can be said?”
“No other animation library is as intuitive, rigorous, conceptually simple and well curated as GreenSock’s”
“I am more and more amazed every day, and very glad that I decided to get a business license.”
“This stuff is so incredibly amazing I can't believe it. The level of details and options put into these things and the natural instinct GreenSock has for solving everyday problems is impressive.”
“The best thing about GSAP is that it just works, and it works well. On every single browser I’ve tested.”
Sign Up For Our Newsletter
Get the latest updates on GreenSock products, exclusive offers, and more right in your inbox.
Your information will always be kept confidential.
Thanks for signing up!
Now you'll begin receiving the latest GreenSock updates, exclusive offers, and more right in your inbox. Welcome aboard.