1.0.14 • Published 11 months ago

@ihtnc/use-animated-canvas v1.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

build deploy npm website release notes

Use Animated Canvas

A React hook to create a canvas element with a built-in render loop. Useful for creating animations, games, and other interactive graphics.

Installation

npm install @ihtnc/use-animated-canvas

Usage

import { use2dAnimatedCanvas } from '@ihtnc/use-animated-canvas'

const App = () => {
  const { Canvas } = use2dAnimatedCanvas({
    render: (context, data) => {
      // this function gets called every frame
      // use context to draw on the canvas
      // use data to access details like frame count, fps, etc
      // data can also include a user-defined value if supplied
    }
  })

  return <Canvas />
};

More usage examples are available here.

1.0.14

11 months ago

1.0.13

11 months ago

1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago