Created
February 10, 2021 15:57
-
-
Save DylanPiercey/4fc3ddab129e6fe6e780504625ffc419 to your computer and use it in GitHub Desktop.
Tween Tag implementation for Marko 6 / FLUURT
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
<let/distance=0/> | |
<let/startTime=0/> | |
<let/curValue=input.default/> | |
<const/ease=input.ease || (v) => v < 0.5 ? 2 * v * v : -1 + (4 - 2 * v) * v/> | |
<yield=curValue onnext=(nextValue) => { | |
startTime = performance.now(); | |
distance = curValue - nextValue; | |
}/> | |
<effect=() => curValue = ease((document.timeline.currentTime - startTime) / input.duration) * distance + curValue/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment