Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set animationData error #50

Open
mtsee opened this issue Jun 24, 2021 · 1 comment
Open

set animationData error #50

mtsee opened this issue Jun 24, 2021 · 1 comment

Comments

@mtsee
Copy link

mtsee commented Jun 24, 2021

function LayerComp() {
   const [animdata, setAnimdata] = useState(null);
    useEffect(() => {
       $.getJSON('https://h5ds-cdn.oss-cn-beijing.aliyuncs.com/other/lottie/data.json').done(res => {
                 setAnimdata(res);
       })
    }, [])

   return <>
     {animdata && (
        <Lottie
          options={{
            assetsPath: 'https://h5ds-cdn.oss-cn-beijing.aliyuncs.com/other/lottie/images',
            animationData: animdata,
            speed: 1, // 速度
            autoplay: true,
            renderer: 'svg',
            loop: true
          }}
        />)}
   </>
}

image

@hestyle
Copy link

hestyle commented Sep 15, 2021

me too +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants