I'm a bit lost computing matrix transform (rotate / translate)
I'm applying a svg transform to a svg rect (r1)
<svg width="400" height="400" viewBox="0 0 400 400"
xmlns="http://www.w3.org/2000/svg">
<g id="r1" transform="translate(20,100) rotate(30, 175, 85)">
<rect width="350" height="170" fill="#69c" fill-opacity=".1" />
</g>
<g id="r2" transform="">
<rect width="150" height="100" fill="green" fill-opacity=".1" />
</g>
<g id="r3" transform="">
<rect width="150" height="100" fill="red" fill-opacity=".1" />
</g>
</svg>
this give me the following transform matrix
SVGMatrix { a: 0.8660253882408142, b: 0.5, c: -0.5, d: 0.8660253882408142, e: 85.945556640625, f: 23.887840270996094 }
if I apply this transform matrix to another rectangle (r2) the rectangle will move to the exact same position of the first one but I lost the initial x,y position before applying the rotation
How can I get these x, y values from the transform matrix ?
translate(x,y) rotate(a, x+rect.w, y+rect.height)
I've made a jsbin to illustrate my problem
https://jsbin.com/luvome/edit?html,js,output
I'm would be very grateful if you can help. thanks.
width,height. it appear I also need to updatex,ybecause after refreshing, my rectangle slightly jump to another position. on refresh, I redrawn rectangle using (translate(x,y), rotate(a, width/2, height/2) and since I dont update x, y, the rectangle is moving - lionelB