跳到主要内容

节点只读数据(NodeReadData)

表示层级中的节点(Node),提供变换属性以及父/子节点访问能力。

字段(Fields)​

position​

节点本地位置(local position)。

rotation​

节点本地旋转(弧度,radians)。

scale​

节点本地缩放(local scale)。

worldTransform​

节点世界变换(world transform)。

x​

本地位置 x 坐标。

y​

本地位置 y 坐标。

scaleX​

本地缩放 x 分量。

scaleY​

本地缩放 y 分量。

paint​

路径效果所作用的描边或填充,来自其 update 收到的节点;否则为 nil。与 asPaint 相同。

function update(self: MyEffect, path: PathData, node: NodeReadData): PathData
local paint = node.paint
if paint then
print(paint.color)
end
return path
end

方法(Methods)​

asPath​

当节点是 Path 时,返回 PathData。

asPaint​

返回路径效果所作用的描边或填充,来自其 update 收到的节点;否则为 nil。

function update(self: MyEffect, path: PathData, node: NodeReadData): PathData
local paint = node:asPaint()
if paint then
print(paint.thickness)
end
return path
end
看完还有疑问?进群交流下!
与众多 Rive 创作者、开发者一起交流探讨与答疑解惑。
加入交流群