拉斐尔在变换方法中的规模中心 [英] Raphael center of scale in transform method

查看:81
本文介绍了拉斐尔在变换方法中的规模中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我正在使用:

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

缩放每个对象(0/0),这是正常工作。

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

然而拉斐尔参考文献指出缩放函数已被弃用,而我应该使用Raphael.transform(...)。

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

我试过:

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?

推荐答案

您可以使用与scale参数相同的方式使用翻译字符串功能:

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

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

这篇关于拉斐尔在变换方法中的规模中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆