Package Exports
- vec2-recycle
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 (vec2-recycle) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
vec2-recycle
Another vanilla vector 2 library with recycling
Similar in scope (and based on) https://github.com/tmpvar/vec2.js. Differences:
- uses a cache to recycle vectors to minimize garbage collection
- uses a number[2] without any prototypes
- is not watchable (unlike the above library--removed for speed purposes)
Simple Example
import * as vec2 from 'vec2-recycle'
const v1 = vec2.create(5, 4)
const v2 = vec2.create(8, 9)
// copies to a new vector
const v3 = vec2.add(v1, v2, true)
// v1 is replaced
vec2.subtract(v1, v2)
vec2.recycle(v2)
API Documentation
https://davidfig.github.io/vec2-recycle/jsdoc/
Installation
yarn add vec2-recycle
or
npm i vec2-recycle
Tests
- Clone repository
- yarn install
- yarn test (for jest test code)
Other Libraries
If you liked pixi-viewport, please try my other open source libraries:
- pixi-scrollbox - pixi.js scrollbox: a masked box that can scroll vertically or horizontally with scrollbars (uses pixi-viewport)
- pixi-ease - pixi.js animation library using easing functions
- intersects - a simple collection of 2d collision/intersects functions. Supports points, circles, lines, axis-aligned boxes, and polygons
license
MIT License
(c) 2020 YOPEY YOPEY LLC by David Figatner