A CSS transform function specifies one coordinate mapping in a CSS transform list. Functions such as
translate(), scale(), rotate() and matrix() have defined argument types and geometrical meanings. The list is composed by matrix multiplication, with the CSS transform origin supplying the surrounding origin translations.[ref]CSS Transforms Module Level 1 by World Wide Web Consortium. §9.1, 2D transform functions; §§3 and 10, composition
For the two-dimensional function
matrix(a,b,c,d,e,f), a homogeneous column-vector convention givesIn particular, and . The six arguments do not fill the displayed matrix row by row.[ref]For an own example with zero origin,
matrix(2,0,0,3,10,-5) maps point toThis combines horizontal scaling by two, vertical scaling by three and a translation. The arguments and coordinates are chosen to isolate the mapping, not to measure a browser's glyph rendering.Order matters when composing functions. With zero origin,
translate(10px,0) scale(2) maps to , while scale(2) translate(10px,0) maps it to . In column-vector form, the first matrix product is and the second ; the translation itself is scaled in the latter.[ref]CSS Transforms Module Level 1 by World Wide Web Consortium. §3, function-list matrix construction; §10, transform lists
The CSS transform reference box is also part of interpreting arguments that use percentages. A function's spelling alone does not determine every resulting coordinate without its lengths, percentage bases, origin and ancestor mappings. The reusable mathematical description is an ordered coordinate transformation with those inputs stated explicitly.
Articles by others on the same topic
There are currently no matching articles.