Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

UnitaryJS

Build Status

logo.png

UnitaryJS is a library for handling canvas with objects.

Demo: Demo

Wiki

wiki

Quick Example

<!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>

Getting started

npm install unitaryjs

and require unitaryjs.

const Unitary = require('unitaryjs');
new Unitary.Vector(1, 1);

Browser

download ./dist/unitary.min.js and load it.

<script src="unitary.js"></script>

Classes

  • BezierCurve
  • Circle
  • CircularSector
  • Doughnut
  • Graph
  • Group
  • Image
  • Line
  • Point
  • Polygon
  • Quadrilateral
  • Rect
  • Segment
  • Text
  • Triangle
  • Vector