0.0.2 • Published 6 months ago

react-bs-planet v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

install

npm install --save react-bs-planet
yarn add react-bs-planet

Basic Example

Alt text

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;
0.0.2

6 months ago

0.0.1

6 months ago