DOMMatrix








A TypeScript sourced
DOMMatrix shim for
Node.js apps and legacy browsers.
The constructor is close to the
DOMMatrix Interface in many respects, but tries to keep a sense of simplicity. In that note, we haven't implemented
DOMMatrixReadOnly methods like
flipX() or
inverse() or aliases for the main methods like the old
rotate3d.
DOMMatrix shim is meant to be a light pocket tool for many things like
svg-path-commander, for a complete polyfill you might want to also consider more
geometry-interfaces
and
geometry-polyfill.
This library implements a full transform string parsing via the static method
.fromString(), which produce results inline with the DOMMatrix Interface as well as a very
elegant method to determine
is2D. Before moving to the
technical details of this script, have a look at the demo.
Demo
See DOMMatrix shim in action,
click me and start transforming.
Installation
``
npm install @thednp/dommatrix
pnpm/bun/deno add @thednp/dommatrix
`
Download the latest version and copy the dist/dommatrix.js
file to your project assets folder, then load the file in your front-end:
`
html