@kobandavis/canvas
v1.2.0
Published
## About
Downloads
68
Readme
Canvas
About
This is a simple library designed to aid with creation and manipulation of the canvas.
This is not intended for anything other than personal use, but additions are welcome.
Included, are 5 classes:
- Canvas
- Mouse
- Vector
- Rectangle
- QuadTree
There are a few helper functions included in src/helper.ts
Example usage of Canvas
import { Canvas } from '@kobandavis/canvas'
const canvas = new Canvas(window.innerWidth, window.innerHeight)
window.onresize = () => canvas.resizeCanvas(window.innerWidth, window.innerHeight)
const loop = (ctx: CanvasRenderingContext2D) => {
canvas.resetDraw()
// draw stuff
}
canvas.setDrawFunction(loop)
canvas.startDrawLoop()