路径VS在Paperjs形状? [英] Path VS Shape in Paperjs?
问题描述
我与Paperjs库一个有趣的问题。由路径的创建多边形的行为是由形状创建对象的行为有很大不同。当用旋转应用的路径对象对待它像一个忍者明星,而我想要的运动完全可以做到的。
I have an interesting issue with the Paperjs library. The behaviour of polygon created by path's is very different from the behaviour of objects created by shape. The path object when applied with a Rotation treats it like a ninja star while the motion I desire is perfectly done.
下面是每个个案的小提琴链接。
Here are the fiddle links for each of the cases.
Path.Rectangle({
center: [0, 0],
size: [40, 40],
fillColor: 'white'
});
Shape.Rectangle({
center: [0, 0],
size: [40, 40],
fillColor: 'white'
});
推荐答案
默认情况下,转换直接应用到路径
对象,而不是存储在该项目的矩阵
。这是由 applyMatrix
属性控制。您可以通过添加全局更改此行为:
By default, transforms are applied directly to a path
object, not stored in the item's Matrix
. This is controlled by the applyMatrix
property. You can change this behavior globally by adding:
settings.applyMatrix = false;
您paperscript,或在项目水平:
to your paperscript, or on the item level with:
this.head = new Path.Rectangle({
center: [0, 0],
size: [40, 40],
fillColor: 'white',
applyMatrix: false
});
这篇关于路径VS在Paperjs形状?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!