import matrixInverse from 'matrix-inverse' ; import { applyMatrixToPoint } from './applyMatrixToPoint' ; param shapeWidth param shapeHeight param t export function extractLinearGradientParamsFromTransform ( shapeWidth , shapeHeight , t ) { const transform = t . length === 2 ? [ ... t , [ 0 , 0 , 1 ] ] : [ ... t ] ; const mxInv = matrixInverse ( transform ) ; const startEnd = [ [ 0 , 0.5 ] , [ 1 , 0.5 ] ] . map ( ( p ) => applyMatrixToPoint ( mxInv , p ) ) ; return { start : [ startEnd [ 0 ] [ 0 ] * shapeWidth , startEnd [ 0 ] [ 1 ] * shapeHeight ] , end : [ startEnd [ 1 ] [ 0 ] * shapeWidth , startEnd [ 1 ] [ 1 ] * shapeHeight ] } ; }