GreenSock Timeline - Basic Tween
--------------------------------
Basic Timeline example with slider
A [Pen](http://codepen.io/davestewart/pen/ACHmx) by [Dave Stewart](http://codepen.io/davestewart) on [CodePen](http://codepen.io/).
[License](http://codepen.io/davestewart/pen/ACHmx/license).
// ----------------------------------------------
// SETUP
// ----------------------------------------------
// variables
var none = Power0.easeOut;
// objects
var $timeline = $('#timeline');
var $playhead = $('#timeline span');
// timeline manipulation
function onUpdate()
{
var p = tl.progress();
var t = tl.totalTime();
var d = tl.totalDuration();
var c = d * p;
$playhead.width((p * 100) + '%').text('Time:' + t.toFixed(3));
}
$timeline
.on('mousemove', function(event){
var w = $timeline.width();
var x = event.offsetX;
var p = x / w;
tl.pause().progress(p);
})
.on('mouseout', function(event){
tl.resume();
});
// ----------------------------------------------
// animation
// ----------------------------------------------
// elements
var box1 = $('#box1').get(0);
// timeline
var tl = new TimelineLite({onUpdate:onUpdate});
// animate main box
tl.to(box1, 10, {left:750, ease:none}, 0);