SKNode的渲染顺序

SKNode的渲染顺序

  SKNode的zPosition属性,指定相对于其父视图的z轴坐标。

  SKNode的渲染顺序

  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.   

  zPosition越大,则越接近用户,即zPosition值大者会把小的给覆盖掉。

  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.

  当一棵树被渲染。1)会计算每个结点zPosition的绝对高度。2)按zPosition绝对值从小到大排序,然后从小到大依次渲染。3)如果2个node的zPosition相等,则优先绘制父类,再绘制子类;或按结果在children array中的次序绘制。

  The SKView class’s ignoresSiblingOrder property controls whether node sorting is enabled for nodes at the same z position.

上一篇:基于vagrant工具在win7下免密登录linux


下一篇:Netty源码分析第1章(Netty启动流程)---->第2节: NioServerSocketChannel的创建