user203212546 - 9 months ago 45

Javascript Question

I'm just beginning to try to find/use a matrix operations library for JS. I want to do simple translation, scale, and rotation operations on 2D matrices. The mozilla developer website recommends GLMatrix for its "focus on speed and performance."

I'm just wanting to do some simple 2D transformations on matrices, e.g. using

`mat2d`

`var a = mat2d.fromValues(2,0,2,0,0,0);`

var b = mat2d.fromValues(1,3,3,1,-1,-2);

var ans = mat2d();

mat2d.multiply(ans,a,b);

`<script src="https://cdnjs.cloudflare.com/ajax/libs/gl-matrix/2.3.2/gl-matrix-min.js"></script>`

but I must not have the syntax right because I get an

`Uncaught TypeError: mat2d is not a function`

`GL-matrix-min.js`

Answer

Source (Stackoverflow)