-
Notifications
You must be signed in to change notification settings - Fork 56
Description
This might be far beyond the scope of this library - but being able to load animation data when it enters the viewport would be great.
Including animation data via import
is good, but if you've got quite a few complex animations on a page, this can increase your bundle size real fast. Particularly if inline bitmaps are part of an animation. I'm working on a project where our average lottie json is ~1mb, and we've got like 6 per page. That's a chunky bundle! A chunky bundle that's getting in the way of my performance scores!
A lazyload feature, built into a library like this could be hella handy. Something like
<Lottie
loop
play
animationData={'./some/static/path.json'}
lazyLoad
placeholder={placeholder.svg}
/>
The Interaction Observer API would be perfect to check if the lottie is in viewport - then if it is, fetch the json and fire up the animation.
Would be very nice.