svg.js中的Raphael.transformPath类似物是什么



Raphael有一个将一条路径转换为另一条路径的漂亮函数:

R.transformPath = function (path, transform) {
return mapPath(path, toMatrix(path, transform));
}

svg.js中有类似的函数吗?

要转换路径数组,您需要执行以下操作:


const arr = path.array()
arr.map(segment => {
// ... add code to get the x and y of all the points used
// for a line it would be segment[1] and segment[2]
const {x, y} = new SVG.Point(segment[1], segment[2]).transform(transform)
return [segment[0], x, y]
})

最新更新