UNPKG

transformation-matrix

Version:

2d transformation matrix functions written in ES6 syntax. Tree shaking ready!

27 lines (24 loc) 898 B
/** * Serialize an affine matrix to a string that can be used with CSS or SVG * @param matrix {Matrix} Affine Matrix * @returns {string} String that contains an affine matrix formatted as matrix(a,b,c,d,e,f) */ export function toCSS (matrix) { return toString(matrix) } /** * Serialize an affine matrix to a string that can be used with CSS or SVG * @param matrix {Matrix} Affine Matrix * @returns {string} String that contains an affine matrix formatted as matrix(a,b,c,d,e,f) */ export function toSVG (matrix) { return toString(matrix) } /** * Serialize an affine matrix to a string that can be used with CSS or SVG * @param matrix {Matrix} Affine Matrix * @returns {string} String that contains an affine matrix formatted as matrix(a,b,c,d,e,f) */ export function toString (matrix) { return `matrix(${matrix.a},${matrix.b},${matrix.c},${matrix.d},${matrix.e},${matrix.f})` }