zposition是啥东西?

The height of the node relative to its parent.
The default value is 0.0. The positive z axis is projected toward the viewer so that nodes with larger z values are closer to the viewer. When a node tree is rendered, the height of each node (in absolute coordinates) is calculated and then all nodes in the tree are rendered from smallest z value to largest z value. If multiple nodes share the same z position, those nodes are sorted so that parent nodes are drawn before their children, and siblings are rendered in the order that they appear in their parent’s children array. Hit-testing is processed in the opposite order.
The SKView class’s ignoresSiblingOrder property controls whether node sorting is enabled for nodes at the same z position.
Important:Important

Descendants of an effect node or a crop node are not rendered with other nodes in the same tree. An effect node (SKEffectNode) renders its children into a private framebuffer as a separate node tree, then the composited image is rendered into the tree that contains the effect node. A crop node (SKCropNode) works similarly; it renders the mask separately, then uses the mask to render its actual descendants into the tree that contains the crop node.


这是SKNode中苹果的官方文档给的,不仔细看的话,你会觉得这是一个z轴的坐标,越大就越离我们近,也就显示的越大。

其实不是的,这是一个“遮盖属性”,也就是同node上的,zPosition大的会遮盖住小的。

这个属性在CALayer中好像也是有的吧?意思一样。就是“显示次序”。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值