canvas-node
TypeScript icon, indicating that this package has built-in type declarations

0.3.23 • Public • Published

Intro

Try to use object to represent canvas drawing.

Still under development

Usage

A basic one would be:

import CanvasNode from 'canvas-node'
 
const canvas = document.getElementById('canvas')
CanvasNode.init({canvas})
const vertexes = [0, 0, 50, 50]
const path = new Path2D()
path.rect(...vertexes)
const box = CanvasNode.drawBox({
    rawVertexes: vertexes,
    name: 'box',
    text: 'box',
    path,
    style: '#58a',
    strokeStyle: '#fff',
    pos: {x: 50, y: 50}
})
 
setTimeout(() => {
  box.moveTo({x: 100, y: 100})
}, 1000)

API

API documents can be found here

License

MIT

Copyright (c) 2017-present, Yuchen Liu

Readme

Keywords

none

Package Sidebar

Install

npm i canvas-node

Weekly Downloads

501

Version

0.3.23

License

MIT

Last publish

Collaborators

  • liuyuchenzh