react-bs-planet

0.0.2 • Public • Published

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;

Readme

Keywords

Package Sidebar

Install

npm i react-bs-planet

Weekly Downloads

3

Version

0.0.2

License

MIT

Unpacked Size

12.3 kB

Total Files

9

Last publish

Collaborators

  • busyboy