Allows granular scrubbing through a Bodymovin timeline with the mouse to help with accurate animation timing and positioning.
Allows granular scrubbing through a Lottie (AKA Bodymovin) timeline with the mouse to help with accurate animation timing and positioning.
This script allows you to scrub through a Lottie animation timeline simply by moving your mouse left to right. It also displays your animation's current time. It's particularly useful if you create long timelines and need to quickly and accurately preview certain points in your animation.
To use it:
let anim = lottie.loadAnimation(animData);
ScrubLottieTimeline()
; and pass in the Lottie reference. So if your instance is called anim
you would write:
ScrubLottieTimeline(anim);
let animData = {
wrapper: document.querySelector('#EMPTY_DIV'),
animType: 'svg',
loop: true,
prerender: true,
autoplay: true,
path: 'PATH_TO_YOUR_JSON'
}, anim = lottie.loadAnimation(animData);
ScrubLottieTimeline(anim)
CodePen demo here