Skip to content

set animationData error #50

@mtsee

Description

@mtsee
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions