canvas-js
Library for easy HTML5 canvas development.
Usage
npm i -S canvas-js
# or just grab required .js file
Circle 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