matrix 3x3
npm install @anderpang/matrix3.jsbash
$ npm i @anderpang/matrix3.js
`
$3
`bash
import Matrix3 from "@anderpang/matrix3.js";
`
or
`html
`
$3
`js
matrix = Matrix3.translate(5, 0).scale(2);
gl.uniformMatrix3fv(loc, false, matrix.data);
`
METHODS
`ts
declare class Matrix3 {
data: Float32Array;
constructor(array?: ArrayLike | ArrayBufferLike);
static identity: (this: typeof Matrix3) => Matrix3;
static translate: (this: typeof Matrix3, tx: number, ty: number) => Matrix3;
static rotate: (this: typeof Matrix3, rad: number) => Matrix3;
static scale: (this: typeof Matrix3, sx: number, sy?: number) => Matrix3;
static projection: (this: typeof Matrix3, width: number, height: number) => Matrix3;
zero(): this;
identity(): this;
copy(): Matrix3;
copyFrom(from: Matrix3): this;
multiply(m: Matrix3): this;
translate(tx: number, ty: number): this;
rotate(rad: number): this;
scale(sx: number, sy?: number): this;
transpose(): this;
}
``