@r0neko/vector2lib

1.0.0 • Public • Published

vector2lib

2D Vector Library for JavaScript.

Installation

vector2lib requires node.js v4+ to run.

Install this package through npm(NodeJS Package Manager).

$ npm install @r0neko/vector2lib

Usage

Instantiate the class by importing it.

const Vector2 = require("@r0neko/vector2lib");

let a = new Vector2(123, 456);

console.log(a); // Vector2 { X: 123, Y: 456 }

// basic addition
a.Add(new Vector2(10, 20)); // or a.Add(10, 20);
console.log(a); // Vector2 { X: 133, Y: 476 }

You have some basic functions like Add, Multiply, Subtract, Angle, AngleDeg, Distance, DistanceSquared, Length, LengthSquared, Rotate and RotateDegrees.

Package Sidebar

Install

npm i @r0neko/vector2lib

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

3.95 kB

Total Files

3

Last publish

Collaborators

  • r0neko