Last active
August 10, 2018 00:38
-
-
Save filipbech/84a5864399111c15619b to your computer and use it in GitHub Desktop.
Running snap.svg animations with GSAP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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