1.0.0 • Published 4 years ago

@m1yh3m/circle.canvas.lib v1.0.0

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

circle.canvas.lib

Library for creating canvas circle

usage

const Circle = require("@m1yh3m/circle.canvas.lib");

a complete example

jsfiddle

var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");

var c = new Circle(); // import it from somewhere

c.in(context)
  .fillWith("maroon")
  .of(20)
  .fillAt(300, 300)
  .fillAt(260, 260)
  .fillWith("teal")
  .fillAt(28, 28)
  .of(38)
  .fillWith("navy")
  .fillAt(100, 100);

var d = new Circle();
d.in(context)
  .fillWith("lime")
  .of(23)
  .fillAt(30, 300);

var e = new Circle();
e.in(context)
  .drawWith({ strokePattern: "black", lineWidth: 4 })
  .of(10)
  .drawAt(300, 30)
  .drawWith({ strokePattern: "blue", lineWidth: 3 })
  .of(20)
  .drawAt(300, 20)
  .drawWith({ strokePattern: "magenta", lineWidth: 2 })
  .of(30)
  .drawAt(300, 50)

  .drawWith({ strokePattern: "black", lineWidth: 5 })
  .of(30)
  .drawAt(300, 140)
  .of(27)
  .fillWith("yellow")
  .fillAt(300, 140);
<canvas id="canvas" height="400" width="400"></canvas>
canvas {
  outline: thin solid #333;
}

copied from

https://github.com/gitfaf/canvas-js