buffering in lottieFiles lottie animation at first go

21 Views Asked by At
const Animation = () => {
    const lottieRef = useRef();
    const {
        gameLottieSrc,
        isLose
    } = useGameContext();

    useEffect(() => {
        if (isLose) {
            if (lottieRef.current) {
                lottieRef.current.load(gameLottieSrc);
            }
        } else {
            if (lottieRef.current) {
                lottieRef.current.load(gameLottieSrc);
            }
        }
    }, [gameLottieSrc]);

    if (isLose) {
        return ( <
            div >
            <
            lottie - player ref = {
                lottieRef
            }
            autoplay loop count = {
                2
            }
            src = {
                gameLottieSrc
            }
            path = {
                gameLottieSrc
            }
            speed = {
                0.6
            }
            background = "transparent"
            className = "dragon raw"
            id = "dragon" >
            <
            /lottie-player> < /
            div >
        );
    }
    export default Animation;

i try to make a game for which i have used lottie-player in which i fetch the json and i pass the json in src but it has buffering animation at first time is there anything in LottieFiles/lottie-player to smoothen the animation

0

There are 0 best solutions below