var tl = new TimelineLite();
$(".box").each(function (index, elem) {
var insertionTime = index * .2;
//original insertMultiple
/*
tl.insertMultiple([
TweenLite.to(elem, .5, {css:{rotation:180}}),
TweenLite.to(elem, 1, {css:{left:200}})
], insertionTime);
*/
//updated to use offsetOrLabel and baseTimeOrLabel
//works great
//comment-out next 2 lines when testing code on bottom
tl.to(elem, 1, {css:{left:200}}, insertionTime, 0);
tl.to(elem, .5, {css:{rotation:180}}, insertionTime, 0);
/*
The next code segment didn't give me expected results.
I thought that the first tween would be inserted .-8 seconds before the end of the timeline AND a new dynamically named label ("label1", "label2", "label3" etc) would be added there as well.
It appears the second tween is added AFTER the first tween is done (end of timeline) and not at the previously created label.
Also it appears if you remove the second tween, I would think that the "left" tweens would overlap, but they do not. Perhaps I'm not understanding how a negative baseTimeOrLabel should work.
*/
/*
var label = "label" + index;
tl.to(elem, 1, {css:{left:200}}, label, -0.8);
tl.to(elem, .5, {css:{rotation:180}}, label);
*/
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.