SVG旋转变换矩阵 [英] SVG rotate transform Matrix

查看:104
本文介绍了SVG旋转变换矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从SVG文件中的元素解析了一个转换属性,比如 rotate(45,30,50),我想将它转换为矩阵形式。
我搜索了它,我找到的只是 rotate(a),没有看起来像这样的坐标 [cos(a )sin(a)-sin(a)cos(a)0 0]

I parsed a transform attribute from an element in an SVG file something like rotate(45,30,50) and I would like to transform it to matrix form. I searched for it and all I could found is only for rotate(a) with no coordinates which looks like this [cos(a) sin(a) -sin(a) cos(a) 0 0]

任何人都可以告诉我如何转换旋转(角度,x,y)到矩阵形式?

can any one show me how to transform the rotate(angle, x , y) to matrix form?

推荐答案

我找到了获取SVG元素的变换矩阵的更简单方法。
使用SVG元素 getCTM()方法我可以获得元素的转换矩阵,包括旋转,平移和其他所有内容。

I found an easier way to get the transformation matrix of an SVG element. Using the SVG element getCTM() method I can get the transformation matrix of the element, including rotation, translation and everything else.

这篇关于SVG旋转变换矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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