I got curious about this and enjoyed the challenge of making it into a single function that'll handle any number of points for you, so you can just feed in the string you want, the stagger, duration, etc. and it'll automate everything and spit back a TimelineLite instance containing all the animation
Here's a forked version of Carl's: http://codepen.io/GreenSock/pen/fbb9dd44bf1c98a9842a6c05d6c1be2b?editors=0010
//this one function call does it all:
staggerPoints("#hi", 2, {points:"100,-50 400,0 600,100"}, 0.5);
//the work is done in this one function that spits back a TimelineLite.
function staggerPoints(selector, duration, vars, stagger, onCompleteAll) {
var numbersExp = /(?-)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig,
element = document.querySelector(selector),
startPoints = element.getAttribute("points").match(numbersExp),
endPoints = vars.points.match(numbersExp),
applyPoints = function() {
element.setAttribute("points", startPoints.join(","));
},
copy = function(obj) {
var o = {}, p;
for (p in obj) {
if (p !== "points") {
o[p] = obj[p];
}
}
return o;
},
tl = new TimelineLite({onUpdate:applyPoints, onComplete:onCompleteAll}),
l = startPoints.length,
obj, i;
if (l !== endPoints.length) {
console.log("Error: point quantities don't match");
}
for (i = 0; i < l; i+=2) {
obj = copy(vars);
obj[i] = parseFloat(endPoints[i]); //note: we need to make sure the values are converted from strings to numbers.
obj[i+1] = parseFloat(endPoints[i+1]);
startPoints[i] = parseFloat(startPoints[i]);
startPoints[i+1] = parseFloat(startPoints[i+1]);
tl.to(startPoints, duration, obj, stagger * i);
}
return tl;
}
Play around with it and let us know if it works okay for you.