Skip to content

Lazy loading animation data would be very handy #11

@EliotSlevin

Description

@EliotSlevin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions