I use react-lotties and i want to put differents animations in many div changing only the url of lotties
(我使用react-lotties,并且我想在许多div中放置不同的动画,仅更改Lotty的网址)
I am a react beginner, be kind please :)
(我是一名初学者,请好心:))
this is my script :
(这是我的脚本:)
- My lotties Component :
(我的彩票组件:)
import React, { Component } from "react"
import Lottie from "react-lottie"
import animationData from "./lotties1.json"
import animationData from "./lotties2.json"
import animationData from "./lotties3.json"
import "./lotties.css"
class LottiesC extends Component {
render() {
const defaultOptions = {
loop: true,
autoplay: true,
animationData: animationData,
rendererSettings: {
preserveAspectRatio: "xMidYMid slice",
},
}
return (
<div className="x">
<Lottie options={defaultOptions} height={600} width={600} />
</div>
)
}
}
export default LottiesC
-My index.js Component:
(-我的index.js组件:)
import React from "react"
import Navigation from "../components/Navigation"
import LottieControl from "../components/LottiesC"
const index = () => {
return (
<section className="index">
<div><LottiesC animationData ={lotties 1} /> </div>
<div><LottiesC animationData ={lotties 2} /> </div>
<div><LottiesC animationData ={lotties 3} /> </div>
</section>
)
}
export default index
ask by tedajo philippe translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…