inferno-canvas-component

0.1.4 • Public • Published

inferno-canvas-component

Build Status NPM bitHound Code

Install

npm install --save inferno-canvas-component

Usage

import Inferno from 'inferno'
import Component from 'inferno-component'
import Canvas from 'inferno-canvas-component'
 
function drawCanvas({ctx, time}) {
    const {width, height} = ctx.canvas
    ctx.save()
    ctx.clearRect(0, 0, width, height)
    ctx.fillStyle = 'black'
    ctx.translate(width / 2, height / 2)
    ctx.rotate(((time / 10) % 360) * Math.PI / 180)
    ctx.fillRect(-1 * width / 4, -1 * height / 4, width / 2, height / 2)
    ctx.restore()
}
 
class App extends Component {
    render() {
        return <Canvas draw={drawCanvas} width={400} height={400} realtime/>
    }
}
 
Inferno.render(<App/>, document.body)

Build

git clone https://github.com/nhz-io/inferno-canvas-component.git
cd inferno-canvas-component
npm install
npm start
...
check http://localhost:9000
...
npm run dist

LICENSE

MIT

VERSION

0.1.4

Package Sidebar

Install

npm i inferno-canvas-component

Weekly Downloads

1

Version

0.1.4

License

MIT

Last publish

Collaborators

  • ishi.ruy