Add animation to Framer

Use Lottie JSON for the Lottie component, or export a code component when you want the animation included in the code file. Both routes start with the same editable Mosso project.

Export a Lottie file

  1. Open an example below and click Export in Mosso.

  2. Under Where it goes, choose Webflow or Framer (no code) and export the .json file.

  3. In Framer, open Insert, search for Lottie and add the component. Upload your JSON file in its properties, or use a public JSON address if the component asks for a URL.

  4. Set the component dimensions to match the animation. Turn on Loop if it should repeat, then check the preview and published page.

Use a code component

  1. In Mosso, choose React, Vue, Svelte or Framer under Where it goes. Export and unzip the component kit.

  2. Open the .tsx file in the framer folder. The animation data is included in that file.

  3. In Framer, open Assets, then Code, and create a new code file. Replace its contents with the exported code.

  4. Drag the component onto your page. Set Loop, Autoplay and Speed in its properties.

The exported component respects reduced motion and loads its player from a public address. It still needs a network connection to load that player. Framer describes Lottie support in its Lottie reference.

If the result is blank

Check that a JSON address serves the actual animation rather than a library page or a sign-in page. If the component cannot use your .lottie file, export Lottie JSON instead.

For the code route, paste the whole Framer file, including its animation data. Check the published page for blocked player requests. Give the component a visible width and height, and try the JSON in the Lottie viewer to check the file itself.

Keep essential words as page text. For the no code route, check reduced motion yourself and use a still image when a visitor should not see a loop.

Code component from a library page

Every library page also has a Framer tab under Use it in code. It is a short code component with a File control. It plays the .lottie file you pick with the dotLottie player and shows a still frame to people who ask for less motion. This is the code for the Notification toast animation:

  1. In Framer, open Assets, then Code, and make a new code file. Paste this in.

  2. Drop the component on the page, give it a width and height, and pick notification.lottie as its File.

Notification.tsx
import { useEffect, useRef } from "react"
import { addPropertyControls, ControlType } from "framer"

const PLAYER = "https://cdn.jsdelivr.net/npm/@lottiefiles/dotlottie-web@0.81.0/+esm"

export default function Notification({ file, style }) {
    const canvas = useRef(null)
    useEffect(() => {
        if (!file) return
        let player
        let gone = false
        // People who ask for less motion see a still frame.
        const still = window.matchMedia("(prefers-reduced-motion: reduce)").matches
        import(/* @vite-ignore */ PLAYER).then(({ DotLottie }) => {
            if (gone || !canvas.current) return
            player = new DotLottie({
                canvas: canvas.current,
                src: file,
                loop: false,
                autoplay: !still,
                renderConfig: { autoResize: true },
            })
            // A frame 68% of the way in, where the animation is complete.
            if (still) player.addEventListener("load", () => player.setFrame(Math.round(0.68 * (player.totalFrames - 1))))
        })
        return () => {
            gone = true
            player?.destroy()
        }
    }, [file])
    return <canvas ref={canvas} role="img" aria-label="Notification" style={{ width: "100%", height: "100%", display: "block", ...style }} />
}

addPropertyControls(Notification, {
    file: { type: ControlType.File, title: "File", allowedFileTypes: ["lottie", "json"] },
})

It loads its player from jsDelivr

The component imports the dotLottie player from cdn.jsdelivr.net the first time it shows. The page needs a network connection, and a strict Content Security Policy has to allow that address.

Give it a width and a height

The canvas fills the component. Give the component a visible width and height on the page; at zero height nothing shows.

Pick the file

Until you choose a .lottie or .json file in the File control, the component draws nothing.

Free downloads and editable examples

The editor and every export format are free, with no card and no Mosso watermark. Library downloads need a free account. You can download up to 50 library animations a day, with the limit resetting at midnight UTC. Each download contains one animation.

Open an example below to try its look. Use its download buttons to get Lottie JSON or dotLottie through your account, or choose Edit this in Mosso to change the layers and export another format. A preview file is for playback, not an account download link.

Create a free account or sign in to download from the library. Read the library licence before sharing the finished work.

See the full export guide

Try these animations

Open an example to try its colours and timing, or edit it in Mosso.

Browse the animation library