Matrix To CSS
Converts gl-matrix(1) mat4 objects into strings that can be applied
as values for css transform
properties on elements.
Why would you want such a thing?
Because if you move elements using...
)
Instead of
.. the translation of the element is done entirely in the GPU and the browser does not repaint, meaning you get significantly better performance when animating objects.
Installation
Browserify/NPM
$ npm install --save matrix-to-css
var matrixToCSS = ;
Component
$ component install charlottegore/matrix-to-css
var matrixToCSS = ;
API and Example Usage
// dependencies.. var mat4 = mat4; var vec3 = vec3; var matrixToCSS = ; // create a mat4 to be out translation matrix var translationMatrix = mat4; // we need an origin matrix, so create another identity matrix.. var origin = mat4; // we need a translation vector var translationVector = vec3; // apply the translation to the matrix mat4; // did you know jQuery will automatically find the right 'transform' for you? ;
That's basically it. It assumes you can make your own matrix using the gl-matrix library.
License
MIT