Skip to content

Instantly share code, notes, and snippets.

@DylanPiercey
Created February 10, 2021 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DylanPiercey/4fc3ddab129e6fe6e780504625ffc419 to your computer and use it in GitHub Desktop.
Save DylanPiercey/4fc3ddab129e6fe6e780504625ffc419 to your computer and use it in GitHub Desktop.
Tween Tag implementation for Marko 6 / FLUURT
<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