// Initialize a 2D matrix
const matrix = new DOMMatrix(); // create a matrix
console.log(matrix.isIdentity); // output: true
// Apply a transform that has no effect
console.log(matrix.translate(0).isIdentity); // output: true
// Apply a transform with effect: this rotates the matrix by 30deg
console.log(matrix.rotate(30).isIdentity); // output: falseDOMMatrixReadOnly: isIdentity property / notebook
DOMMatrixReadOnly: isIdentity property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.