Home > Net >  How to get transform matrix of a DOM element?
How to get transform matrix of a DOM element?

Time:01-14

How to get transform matrix of a DOM element? Just like canvas context, do we have a getTransform() method on DOM?

CodePudding user response:

getComputedStyle($el).transform should return a 2 x 3 transformation matrix, IF there is any 2d transformation, and 4 x 4 matrix3d if there is transformation on the z axis too. See my answer here for how to manipulate that in case.

  •  Tags:  
  • Related