Closed SquirrelDeveloper closed 3 months ago
Hi @SquirrelDeveloper, We don't have plans to support the intermission
parameter at the moment, but you can easily achieve the same behavior with just a couple of extra lines of code. By adding an event listener for the complete
event and using setTimeout
, you can implement the intermission before replaying the animation.
import { DotLottie } from "https://esm.sh/@lottiefiles/dotlottie-web";
// Define the duration of the intermission between animation loops in milliseconds
const intermission = 1000; // 1 second
const dotLottie = new DotLottie({
canvas: document.querySelector("#dotLottie-canvas"),
src: "https://lottie.host/9ac9c440-c19e-4ac9-b60e-869b6d0ef8cb/7h97gYMCNE.lottie",
autoplay: true
});
// Add an event listener to the dotLottie instance that triggers when the animation completes
dotLottie.addEventListener("complete", () => {
// Set a timeout to pause for the intermission duration, then replay the animation
setTimeout(() => dotLottie.play(), intermission);
});
You can also check out this CodePen example: https://codepen.io/lottiefiles/pen/PorQjXg
@SquirrelDeveloper, I just noticed you're using dotLottie-react
. I've also provided a React example showing how you can achieve the intermission behavior. It's quite similar to the previous example I shared, but this one is specifically for dotLottie-react
.
You can check it out here: https://codepen.io/lottiefiles/pen/mdZXwov
@SquirrelDeveloper, I'm closing this issue. If you encounter any problems with the provided approach, please feel free to reopen it. Thanks!
@theashraf Thanks a lot for your detailed response, it helped me a lot, Regards
Overview
Hi, The
intermission
parameter of the react player doesn't seem implemented (I am migrating from the old player that had this option) Any plan to support it in the future ?Regards
Type