I have various elements performing various transform animations and I need to get their values
- translateX
- translateY
- translateZ
- rotateX
- rotateY
- rotateZ
scale
$('.selector').css('transform');
sometimes it gives me a matrix() sometimes a matrix3d, and I have no idea how can I safely get my values I need.
What I need is, no matter if the current transform is a matrix or matrix3d, I need all the above values, even if they are undefined or NaN.
transform
property. Imagine you havetranslateX rotateY translateX
to change the axis where you rotate the element around. While the animation active you can AFAIK only access the compute values. While not fully related, this might help you: Get Value of CSS Rotation through JavaScript – t.niesetransformation
is not like an object having the propertiestranslateX
,translateY
, ... . But an array with transformation applied in order. The transformations and their order don't need to be the same between both states, thats IMHO the reason why you won't get those individual transformation but only the final matrix. But if it is a controlled setup you might be able to retrieve it form thematrix
– t.niese