Adding Lottie Animations to Svelte Application
Ever animated something cool in Figma or Adobe After Effects? It's possible to implement those animations in a friendly web format with Lottie.
Creating Animations
You can create Lottie Animations in Figma by installing the LottieFiles Figma Plugin, then export your Flow.
Installing Lottie
Adding Lottie
Lottie should only be initialised, after the DOM is mounted. In Svelte we can use this by using the $effect()
(Svelte 5) or the onMount()
function (Svelte 4), for the sake of this tutorial, I will create it in Svelte 4, but I will update it later to Svelte 5.
An example of a lottie animation that'll play when clicked (hamburger menu animation) and reverse, when clicked again
Last updated