canvas-js
Library for HTML5 canvas.
Last updated 2 years ago by git.faf .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install canvas-js 
SYNC missed versions from official npm registry.

Build Status


NPM


canvas-js

Library for easy HTML5 canvas development.

Usage


    npm i -S canvas-js

    # or just grab required .js file

Circle API

jsfiddle older API


  var circle = new Circle();
  // context is 2D context of the canvas element of interest.
  // pattern is fillStyle
  // radius is a number
  // at finally fills the circle at x, y co-ordinates.
  circle.in(context).fillWith(pattern).of(radius).fillAt(x, y);


  var circle = new Circle();
  // context is 2D context of the canvas element of interest.
  // pattern is {strokePattern: pattern|gradient|color, lineWidth: number}
  // radius is a number
  // at finally draws the circle (outline/perimeter) at x, y co-ordinates.
  var options = { strokePattern: 'red', lineWidth: 3 };
  circle.in(context).drawWith(options).of(radius).drawAt(x, y);

NodeJS example


  var canvas = require('canvas-js-lib')

  canvas
  { Circle: [Function: Circle] }

  var c = new canvas.Circle()
  undefined

  c
  { startAngle: 0,
    endAngle: 6.283185307179586,
    antiClockwise: false }

  c.in('context')
  { startAngle: 0,
    endAngle: 6.283185307179586,
    antiClockwise: false,
    context: 'context' }
  >

Chaining is awesome

in, *With, of and *At return the circle object, thus chaining is possible.

License

MIT © Anubhav Saini 2016 - 2018

Current Tags

  • 4.0.0                                ...           latest (2 years ago)

5 Versions

  • 4.0.0                                ...           2 years ago
  • 3.0.0                                ...           2 years ago
  • 2.2.0                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 1
Last Month 3
Dependencies (0)
None
Dev Dependencies (8)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |