Skip to content
A fast, simple, 2D vector class in Javascript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitattributes
LICENSE
README.md
yuidoc.json

README.md

vec2

A fast, simple, 2D vector class in Javascript

GitHub issues GitHub license

Example usage

// Vectors can be instantiated with "new Vec2()" 
let vector = new Vec2(5, 6);

// Or by copying an existing vector
let newVector = vector.copy();

// Chaining is supported for quickly modifying the vectors
newVector.shift(3, 2)
	 .scale(2)
	 .rotate(Math.PI);

// For operations between vectors, any object with x and y members can be passed in
vector.subtract(newVector);

Docs

Docs can be generated with YUIdocs which can be installed via npm and run as follows.

npm install yuidocsjs
yuidoc .
You can’t perform that action at this time.