vectiny

very tiny 2D vectors.

Usage no npm install needed!

<script type="module">
  import vectiny from 'https://cdn.skypack.dev/vectiny';
</script>

README

vectiny

very tiny 2D vectors.

var loc = V(100,100);
var vel = V(15,12);
var grav = V(0,-9.2);

// Add them
vel = vel.add(grav);
loc = loc.add(vel);

// Find the magnitude
var speed = vel.magnitude();

Methods include: add, sub, mult, unit, limit, mag, to and from.

License

MIT