Skip to content

Instantly share code, notes, and snippets.

@filipbech
Last active August 10, 2018 00:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save filipbech/84a5864399111c15619b to your computer and use it in GitHub Desktop.
Save filipbech/84a5864399111c15619b to your computer and use it in GitHub Desktop.
Running snap.svg animations with GSAP
/* Define the animation with snap.svg*/
var mySnapAni = myPath.animate({
d:newDValue
},200); /* duration:200 doensn't matter since playback is via GSAP */
/* Get the animation controller */
var mySnapAniCtrl = mySnapAni[0].anims[Object.keys(mySnapAni[0].anims)[0]];
/* Pause the animation right away*/
mySnapAniCtrl.pause();
var tweenerObj={progress:0};
TweenLite.to(tweenerObj, 2, { /* this duration (in seconds) is what matters */
progress:1,
onUpdate:function() {
mySnapAniCtrl.status(tweenerObj.progress);
mySnapAniCtrl.update();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment