iOS Developer Library — Pre-Release

Developer

SpriteKit Framework Reference SKCropNode Class Reference

Options
Deployment Target:

On This Page
Language:

SKCropNode

An SKCropNode crops the pixels drawn by its children so that only some of the pixels are rendered to the parent’s framebuffer. More...

Inheritance


Conforms To


Import Statement


Swift

import SpriteKit

Objective-C

@import SpriteKit;

Availability


Available in iOS 7.0 and later.
  • maskNode maskNode Property

    The node used to determine the crop node’s mask.

    Declaration

    Swift

    var maskNode: SKNode?

    Objective-C

    @property(nonatomic, retain) SKNode *maskNode

    Discussion

    The node supplied to the crop node must not be a child of another node; however, it may have children of its own.

    When the crop node’s contents are rendered, the crop node first draws its mask into a private buffer. Then, it renders its children. When rendering its children, each pixel is verified against the corresponding pixel in the mask. If the pixel in the mask has an alpha value of less than 0.05, the image pixel is masked out. Any pixel not rendered by the mask node is automatically masked out.

    The default value of this property is nil, which indicates that the child nodes should not be cropped.

    Import Statement

    Swift

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.