airbnb / lottie-web

Render After Effects animations natively on Web, Android and iOS, and React Native. http://airbnb.io/lottie/
MIT License
29.85k stars 2.85k forks source link

Cannot load multiple instances of the same animation in a single container. #2975

Open AlexanderTheWise opened 1 year ago

AlexanderTheWise commented 1 year ago

Tell us about your environment

Browser and Browser Version

What did you do?

  onMounted(() => {
    const animationItems: AnimationItem[] = Array(2).fill(
      lottie.loadAnimation({
        container: document.querySelector(".eyes")!,
        renderer: "svg",
        loop: false,
        animationData: eyes,
        initialSegment: [1, 20],
      })
    );
  });

What did you expect to happen?

What actually happened?

BokunoMasayume commented 1 year ago

try this: container: document.querySelector(".eyes").apendChild(document.createElement("div"))