You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

canvas-lib

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canvas-lib

canvas library with a delightful API

0.0.4
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

canvas-lib

Canvas library with a delightful API.

Feature

  • support all kinds of shapes, draw with no side-effect
  • group shapes support
  • mouse event system
  • transform, scale and translate canvas coordinate
  • drag & drop shape
  • support basic animation
  • physical effects

API

See here

example

const canvas = new Canvas(document.querySelector('canvas'));

const rect = new Rect({
  x: 10,
  y: 20,
  width: 100,
  height: 100,
  fillStyle: 'blue',
});

rect.on('click', (e, shape) => {
  console.log('rect being clicked');
});

canvas.add(rect);

Design

  • Canvas, shape container, add/remove/draw shape, event delegation and dispatch
  • Shape, All concrete shape extends Shape, style、position property and shapes'events stored here
  • Group, special Shape container, it stored shape added to it. and change it's property like style and position

Keywords

canvas

FAQs

Package last updated on 24 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts