Raphael Scale Center in Transformation Method

Now I am using:

r.forEach( function (el) { el.scale(0.5, 0.5, 0.0, 0.0); }); 

scale each object around (0/0), which works fine.

The Raphael manual states that the scaling function is out of date, and I should use Raphael.transform (...) instead.

I tried:

 r.forEach( function (el) { el.transform("S(0.5)"); }); 

however, it will scale the paths using the center of the image as the center of the scale. How can I achieve the same effect with the conversion function?

+4
source share
2 answers

You can use the translation string in the same way as the parameters of the "scale" function:

 el.transform("s0.5, 0.5, 0, 0"); 
+5
source
 el.transform("S0.5, 0.5, 0, 0"); 

here>

+1
source

Source: https://habr.com/ru/post/1403409/


All Articles