Package Exports
- dommatrix
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 (dommatrix) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
DOMMatrix (Constructor) shim
An ES6/ES7 sourced DOMMatrix shim for Node.js apps and legacy browsers originally authored by Arian Stolwijk with his CSSMatrix. The constructor should work as defined by the W3C CSS3 3D Transforms specification.
This version comes with the following changes:
- removed
afine
property and replaced it withis2D
to be more inline with DOMMatrix - added
isIdentity
property - while applying methods the above properties change
- fixed the
translate()
instance method to work with one axis transformation, also inline with DOMMatrix - removed
inverse()
instance method - removed
transform()
instance method - removed
toFullString()
instance method
Install
npm install dommatrix
Usage
It should be compatible with documentation defined at w3.org and WebKitCSSMatrix Safari documentation.
Examples
// ES6/ES7
import CSSMatrix from 'dommatrix'
// init
let myMatrix = new CSSMatrix('perspective(400px) rotateX(45deg)')
// call methods, also numeric values should work
myMatrix.translate(45)
OR
// Node.js
var CSSMatrix = require('dommatrix');
// init
let myMatrix = new CSSMatrix('rotate(45deg)')
Methods
translate(x, y, z)
scale(x, y, z)
rotate(rx, ry, rz)
rotateAxisAngle(x, y, z, angle)
skewX(angle)
skewY(angle)
toString()
License
DOMMatrix is MIT Licensed.