Raphael center of scale in transform method

这一生的挚爱 提交于 2019-12-07 08:58:48

问题


Right now I'm using:

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

to scale each object around (0/0), which is working fine.

The Raphael reference however states that the scale function is deprecated and I'm supposed to use Raphael.transform(...) instead.

I tried:

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

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


回答1:


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

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



回答2:


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

solved here



来源:https://stackoverflow.com/questions/9867975/raphael-center-of-scale-in-transform-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!