import type { Transform , Matrix } from '@pixi/math' ; ignore param transform param matrix param rotation param pivot export function decomposeTransform ( transform , matrix , rotation ? , pivot = transform . pivot ) { const a = matrix . a ; const b = matrix . b ; const c = matrix . c ; const d = matrix . d ; const skewX = - Math . atan2 ( - c , d ) ; const skewY = Math . atan2 ( b , a ) ; rotation = rotation !== undefined && rotation !== null ? rotation : skewY ; transform . pivot . set ( pivot . x , pivot . y ) ; transform . rotation = rotation ; transform . skew . x = rotation + skewX ; transform . skew . y = - rotation + skewY ; transform . scale . x = Math . sqrt ( ( a * a ) + ( b * b ) ) ; transform . scale . y = Math . sqrt ( ( c * c ) + ( d * d ) ) ; transform . position . x = matrix . tx + ( ( pivot . x * matrix . a ) + ( pivot . y * matrix . c ) ) ; transform . position . y = matrix . ty + ( ( pivot . x * matrix . b ) + ( pivot . y * matrix . d ) ) ; return transform ; }