How do I integrate a JS animation code in React application

↘锁芯ラ 提交于 2021-02-11 12:32:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!