Skip to content

Instantly share code, notes, and snippets.

@abernier
Forked from anonymous/tl.js
Created August 15, 2016 11:39
Show Gist options
  • Save abernier/0da4d2561e574cd4e3e6b65e215c3939 to your computer and use it in GitHub Desktop.
Save abernier/0da4d2561e574cd4e3e6b65e215c3939 to your computer and use it in GitHub Desktop.
//
// anim1
//
var anim1 = function (duration) {
var tl = new TimelineMax();
//
// Define tweens
//
var tw1 = new TweenMax.fromTo(elA, 1, {borderWidth: 0}, {borderWidth: 4});
var tw2 = new TweenMax.staggerFromTo(myEls, 2, {scaleX: 0, force3D: true}, {scaleX: 1}, .2);
// Add more tw...
//
// Add tweens to the timeline
//
tl.add(tw1);
tl.add(tw2);
//
// Rescale time
//
(typeof duration !== 'undefined') && tl.timeScale(tl.totalDuration()/(duration+.000001));
return tl;
};
//
// anim2
//
var anim2 = function (duration) {
...
};
//
// Compose anim1+2 together
//
var tl = new TimelineMax();
var tw1 = anim1(4);
var tw2 = anim2(8);
tl.add(tw1);
tl.add(tw2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment