react-bs-planet
0.0.2 • Public • Published install
npm install --save react-bs-planet
yarn add react-bs-planet
Basic Example
import Planet from "react-bs-planet";
function App() {
const plugin = useRef(); // start, stop, status:1:旋转中,0:停止状态
const mouseEnter = () => {
plugin.current.stop();
};
const mouseLeave = () => {
plugin.current.start();
};
return (
<>
<Planet
ref={plugin}
autoRotate={true}
speed={0.005}
startAngle={0}
style={{ width: "500px", height: "300px" }}
>
{new Array(6).fill(null).map((item, index) => (
<div
key={index}
className="item"
onMouseEnter={mouseEnter}
onMouseLeave={mouseLeave}
></div>
))}
</Planet>
</>
);
}
export default App;
Package Sidebar
Install
Weekly Downloads