JSPM

@r0neko/vector2lib

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q13898F
  • License ISC

Vector2 Implementation in JS.

Package Exports

  • @r0neko/vector2lib

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@r0neko/vector2lib) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.