Matrix2D
2D transformation matrix for implementing transformations such as translation, rotation, and scaling.
Overview
Matrix2D wraps DOMMatrix, providing 2D graphics transformation functionality.
Creation
import {Matrix2D} from '@wangyaoshen/locus';
// Identity matrix
const matrix = Matrix2D();
// From element
const fromElement = Matrix2D.fromElement(element);
// From array
const fromArray = Matrix2D.fromArray([a, b, c, d, e, f]);
Methods
translate(x: number, y: number): Matrix2D
rotate(angle: number): Matrix2D
scale(x: number, y: number): Matrix2D
multiply(other: Matrix2D): Matrix2D
inverse(): Matrix2D