Transform Matrix
The matrix() and matrix3d() functions represent all 2D and 3D transforms as a single mathematical matrix. While rarely written by hand, understanding them explains how CSS transforms are calculated internally.
2D Matrix
matrix(a, b, c, d, tx, ty) encodes scale, rotation, skew, and translation into six values. The browser composes all transform functions into a single matrix before rendering.
3D Matrix
matrix3d() uses a 4×4 matrix — 16 values — to encode all 3D transformations including perspective.
Practical Use
The DOMMatrix JavaScript API lets you read, compose, and apply matrices programmatically for animations and draggable interfaces.