Skip to main content

parse_transform_matrix

Function parse_transform_matrix 

Source
pub fn parse_transform_matrix(value: &str) -> Option<([f64; 16], bool)>
Expand description

Parse a CSS transform list into a 4x4 matrix, as required by the DOMMatrix(DOMString) constructor and DOMMatrix.setMatrixValue() (https://drafts.fxtf.org/geometry/#parse-a-string-into-an-abstract-matrix).

Returns the 16 matrix components in column-major order (m11, m12, ..., m44) and whether the list contained only 2D transform functions. Returns None if the string fails to parse as a transform list or uses relative lengths (which cannot be resolved without a context).