iOS Developer Library

Developer

SpriteKit Framework Reference SKEffectNode Class Reference

Options
Deployment Target:

On This Page
Language:

SKEffectNode

An SKEffectNode object renders its children into a buffer and optionally applies a Core Image filter to this rendered output. Use effect nodes to incorporate sophisticated special effects into a scene or to cache the contents of a static subtree for faster rendering performance. More...

Inheritance


Conforms To


Import Statement


import SpriteKit @import SpriteKit;

Availability


Available in iOS 7.0 and later.
  • A Boolean value that determines whether the effect node applies the filter to its children as they are drawn.

    Declaration

    Swift

    var shouldEnableEffects: Bool

    Objective-C

    @property(nonatomic) BOOL shouldEnableEffects

    Discussion

    If the value of this property is YEStrue, the effect node applies the filter and blends the results. If the value is NOfalse, the effect node is ignored and its children are rendered normally. The default value is NOfalse.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • filter filter Property

    The Core Image filter to apply.

    Declaration

    Swift

    var filter: CIFilter?

    Objective-C

    @property(nonatomic, retain) CIFilter *filter

    Discussion

    The Core Image filter must have a single inputImage parameter and produce a single outputImage parameter. The default value is nil. If the value is nil and the effect node is enabled, no filtering takes place. However, its children are still rendered in a separate pass and blended to the parent’s framebuffer.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • A Boolean value that determines whether the effect node automatically sets the filter’s image center.

    Declaration

    Swift

    var shouldCenterFilter: Bool

    Objective-C

    @property(nonatomic) BOOL shouldCenterFilter

    Discussion

    If the value of this property is YEStrue and the filter has an inputCenter parameter, the effect node automatically sets the filter’s input center to the effect node’s origin. The default value is YEStrue.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • blendMode blendMode Property

    The blend mode used to draw the filtered image into the parent’s framebuffer.

    Declaration

    Swift

    var blendMode: SKBlendMode

    Objective-C

    @property(nonatomic) SKBlendMode blendMode

    Discussion

    The default value is SKBlendModeAlpha.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • shader shader Property

    A custom shader that is called when the effect node is blended into the parent’s framebuffer.

    Declaration

    Swift

    var shader: SKShader?

    Objective-C

    @property(nonatomic, retain) SKShader *shader

    Discussion

    The default value is nil, meaning that default blending behavior executes. If a shader is specified, it is called when the rasterized image is blended into the parent’s framebuffer.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 8.0 and later.

  • A Boolean value that indicates whether the results of rendering the child nodes should be cached.

    Declaration

    Swift

    var shouldRasterize: Bool

    Objective-C

    @property(nonatomic) BOOL shouldRasterize

    Discussion

    If the value of this property is YEStrue, the effect node caches the filtered image for use in future frames. If the value is NOfalse, then Sprite Kit discards the rendered image and redraws it from scratch the next time the node is rendered. The default value is NOfalse. Caching the rendered image uses more memory and may take more time to render. However, if the effect node’s descendants rarely change, caching can improve performance.

    When caching is enabled, changes to the effect node’s children trigger updates to the cached image in the next frame of animation. However, changing the filter’s properties does not.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.