If you know the coordinates of the center point, then you can combine a translate and scale in one transformation. The translation is calculated as: (1 - scale) * currentPosition
.
If the center is (10, 20)
and you are scaling by 3
then translate by (1 - 3)*10, (1 - 3)*20
= (-20, -40)
:
The transformations are applied in reverse order from the one they are declared, so in the example, above, the scale
is performed first and then the translate
. Scaling affects the coordinates so the translation here is in scaled coordinates.
You can calculate the center point programmatically using element.getBBox()
.