UnitaryJS is a library for handling canvas with objects.
Demo: Demo
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Sample</title>
<script src="./unitary.js"></script>
<script>
const {Point, Triangle} = Unitary;
const A = new Point(30,30),
B = new Point(90,90),
C = new Point(90,40),
ABC = new Triangle(A, B, C),
circumcircleABC = ABC.getCircumcircle(),
incircleABC = ABC.getIncircle(),
canvas = new Canvas('canvas');
canvas.add(ABC);
canvas.add(circumcircleABC);
canvas.add(incircleABC);
canvas.draw();
</script>
</head>
<body>
<canvas id="canvas" width="200" height="200"></canvas>
</body>
</html>
npm install unitaryjs
and require unitaryjs.
const Unitary = require('unitaryjs');
new Unitary.Vector(1, 1);
download ./dist/unitary.min.js and load it.
<script src="unitary.js"></script>
- BezierCurve
- Circle
- CircularSector
- Doughnut
- Graph
- Group
- Image
- Line
- Point
- Polygon
- Quadrilateral
- Rect
- Segment
- Text
- Triangle
- Vector