Skip to main content

Module utils

Module utils 

Source
Expand description

Port of src/ast/transform/utils.ts: matrix operations of the transform functions.

Constants§

IDENTITY_MATRIX
the identity matrix

Functions§

decompose
decompose a matrix: translate → rotate → skew → scale. false if the matrix cannot be decomposed
identity
is_2d_matrix
https://drafts.csswg.org/css-transforms-1/#2d-matrix
is_identity
true if the values are equal (===) to the values of the identity matrix
js_hypot
Math.hypot() (v8 algorithm: scaled, compensated sum)
multiply
multiply_in_place
matrix = matrix × b
multiply_into
result = a × b (the operands are read before the result is written)
round
round a number to 6 significant digits, or to the nearest integer when it is closer than epsilon
set_identity
to_precision6
+value.toPrecision(6)
to_zero
to_zero_value
a value close to 0 (epsilon) is set to 0, the other values are rounded to 6 significant digits