Skip to content

Instantly share code, notes, and snippets.

View Indrajitsaha1997's full-sized avatar

Indrajit Saha Indrajitsaha1997

View GitHub Profile
@Indrajitsaha1997
Indrajitsaha1997 / LottieInHtml.md
Created March 28, 2023 09:40
Lottie in HTML (On click)

Use Lottie In HTML

First you have to add Bodymovin. Bodymovin is a free extension that lets you export After Effects compositions as JSON files to embed in websites and add to apps.

npm install lottie-web

And then, in your HTML file, include the script from the dist folder in the installed package. You could also import the library as a module from Skypack

import lottieWeb from 'https://cdn.skypack.dev/lottie-web';

N.B. : If you are getting the following error,

"Uncaught SyntaxError: Cannot use import statement outside a module"