问题
I am looking to integrate motion animation as my background in my React project. I'm trying to add a firefly animation into a component within react (and the code I'm trying to use is here
https://codepen.io/celli/pen/xZgpvN
).
function App() {
return <Background total={25} / >
}
ReactDOM.render( <App / > , document.querySelector("#container"))
<div id="container" />
<!-- React -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.4/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.4/umd/react-dom.production.min.js"></script>
<!-- TweenMax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.15.0/TweenMax.min.js"></script>
I'm stuck where to put the HTML, CSS, JS components with my react app.
Can somebody look into this guy's answer and help me restructure my react app to get the background as of firefly animation.
https://stackoverflow.com/a/58574900/10635180
I'm new to React and experimenting. I would really appreciate it if anyone can help me integrate with the latest react class-based approach.
来源:https://stackoverflow.com/questions/63000709/how-do-i-integrate-a-js-animation-code-in-react-application