transformation-matrix
Advanced tools
Comparing version 2.0.0 to 2.0.2
{ | ||
"name": "transformation-matrix", | ||
"version": "2.0.0", | ||
"version": "2.0.2", | ||
"description": "2d transformation matrix functions written in ES6 syntax. Tree shaking ready!", | ||
@@ -5,0 +5,0 @@ "main": "./build-commonjs/index.js", |
@@ -183,2 +183,53 @@ declare module 'transformation-matrix' { | ||
declare module 'transformation-matrix/fromDefinition' { | ||
/** | ||
* Converts array of matrix descriptor to array of matrix | ||
* @param definitionOrArrayOfDefinition {Object[]} Array of object describing the matrix | ||
* @returns {Matrix[]} Array of matrix | ||
* | ||
* @example | ||
* > fromDefinition([ | ||
* { type: 'matrix', a:1, b:2, c:3, d:4, e:5, f:6 }, | ||
* { type: 'translate', tx: 10, ty: 20 }, | ||
* { type: 'scale', sx: 2, sy: 4 }, | ||
* { type: 'rotate', angle: 90, sx: 50, sy: 25 }, | ||
* { type: 'skewX', angle: 45 }, | ||
* { type: 'skewY', angle: 45 }, | ||
* { type: 'shear', shx: 10, shy: 20} | ||
* ]) | ||
* | ||
* [ | ||
* { a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }, | ||
* { a: 1, c: 0, e: 10, b: 0, d: 1, f: 20 }, | ||
* { a: 2, c: 0, e: 0, b: 0, d: 4, f: 0 }, | ||
* { a: 6.123, c: -1, e: 0, b: 1, d: 6.123, f: 0 }, | ||
* { a: 1, c: 0.99.., e: 0, b: 0, d: 1, f: 0 }, | ||
* { a: 1, c: 0, e: 0, b: 0.99, d: 1, f: 0 }, | ||
* { a: 1, c: 10, e: 0, b: 20, d: 1, f: 0 } | ||
* ] | ||
**/ | ||
export function fromDefinition(...definitionOrArrayOfDefinition: Matrix[]): Matix[]; | ||
} | ||
declare module 'transformation-matrix/fromTransformAttribute' { | ||
/** | ||
* Parser for SVG Trasform Attribute http://www.w3.org/TR/SVG/coords.html#TransformAttribute <br/> | ||
* Warning: This should be considered BETA until it is released a stable version of pegjs. | ||
* @param transformString {string} Transform string as defined by w3 Consortium | ||
* @returns {Matrix[]} Array of MatrixDescriptor | ||
* | ||
* @example | ||
* > fromTransformAttribute('translate(-10,-10) scale(2,2) translate(10,10)') | ||
* [ | ||
* { type: 'translate', tx: -10, ty: -10}, | ||
* { type: 'scale', sx: 2, sy: 2 }, | ||
* { type: 'translate', tx: 10, ty: 10} | ||
* ] | ||
* | ||
* > compose(fromDefinition(fromTransformAttribute('translate(-10, -10) scale(10, 10)'))) | ||
* { a: 10, c: 0, e: -10, b: 0, d: 10, f: -10 } | ||
*/ | ||
export function fromTransformAttribute(transformString: string): Matrix[]; | ||
} | ||
declare module 'transformation-matrix' { | ||
@@ -200,2 +251,4 @@ export * from 'transformation-matrix/applyToPoint'; | ||
export * from 'transformation-matrix/smoothMatrix'; | ||
export * from 'transformation-matrix/fromDefinition'; | ||
export * from 'transformation-matrix/fromTransformAttribute'; | ||
} |
419265
6043