0.1.0 • Published 4 years ago

react-canvas-dom v0.1.0

Weekly downloads
2
License
MIT
Repository
-
Last release
4 years ago

react-canvas-dom

Canvas component and hooks for reactjs

Usage

Install it with npm or yarn

npm: npm i react-canvas-dom

yarn: yarn add react-canvas-dom

Import the component and use it:

Import Canvas from 'react-canvas-dom'

const draw = (ctx, i) => {
  ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
  ctx.fillStyle = "#000000";
  ctx.beginPath();
  ctx.arc(50, 50, 20 * Math.sin(i * 0.05) ** 2, 0, 2 * Math.PI * Math.sin(i * 0.05) ** 2);
  ctx.fill();
}

const App = () => <Canvas draw={draw} />

export default App
0.1.0

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago