最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Raphael center of scale in transform method - Stack Overflow

programmeradmin6浏览0评论

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?

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?

Share Improve this question asked Mar 26, 2012 at 7:07 triggerfishtriggerfish 431 silver badge3 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

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

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

solved here

发布评论

评论列表(0)

  1. 暂无评论