You can also just add it to your package.json file, and it will be installed the next time you run npm install:
{ "dependencies": { "termestry": "^0.0.1" }}
Basic Usage
Drawing a Rectangle
import { Canvas, Paint, Color, Size, Point } from "termestry";const myPaint = new Paint( Color.RED /* stroke color */, Color.BLUE /* fill color */);const myCanvas = new Canvas(myPaint); /* create a canvas with the paint */const size = new Size(10, 10);myCanvas.rect( Point.centerFor(size), size); /* draw a rectangle at the center of the screen */myCanvas.draw(); // draw the canvas
Creating a stick figure
import { Paint, Color, Size, Point, Canvas } from './src/index.js';const myPaint = new Paint( Color.Red, /* stroke color */ Color.None, /* fill color */);const myCanvas = new Canvas(myPaint); /* create a canvas with the paint */// What is a stick figure?// O <- A circle (head)// --- <- A long line (arms)// | <- A line (body)// / \ <- Two lines (legs)const head = new Size(6, 6);const body = new Size(1, 5);const arms =
For API usage, and more specific examples, refer to the API (⚠️ Link Broken ⚠️).
Project Status
Termestry is currently in alpha. While the current API is stable, there may be breaking changes in the future, and more features will be added.
To help with the development of Termestry, you can contribute to the project by submitting issues, pull requests, or shooting me an email at RedYetiDev@gmail.com.
License
Termestry is licensed under the CC BY 4.0 license. This means that you can use Termestry in any way you want, as long as you give credit to me, the original author (RedYetiDev).
What is "as long as you give credit to me"?
Giving credit is showing that you used Termestry in your project. This can be done by linking to the GitHub repository, or by linking to the npm package.
Can I use Termestry in a commercial project?
Of course! You can use Termestry in any project, commercial or not, as long as you give credit to me.
new
Size
(
5
,
1
);
const legs = new Size(5, 2);
const center = Point.centerFor(head);
// The head
myCanvas.ellipse(
center, // Where to draw the head
head.width / 2, // The X radius
head.height / 2, // The Y radius
0, // The rotation
0, // The start angle
2 * Math.PI, // The end angle (2 * PI is a full circle)