iOS Developer Library

Developer

SpriteKit Framework Reference SKEmitterNode Class Reference

Options
Deployment Target:

On This Page
Language:

SKEmitterNode

A SKEmitterNode object is a node that automatically creates and renders small particle sprites. Particle sprites are privately owned by Sprite Kit—your game cannot access the generated sprites. For example, this means you cannot add physics shapes to particles. Emitter nodes are often used to create smoke, fire, sparks, and other particle effects. More...

Inheritance


Conforms To


Import Statement


import SpriteKit @import SpriteKit;

Availability


Available in iOS 7.0 and later.
  • The rate at which new particles are created.

    Declaration

    Swift

    var particleBirthRate: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleBirthRate

    Discussion

    The number of particles generated by the emitter every second. The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • Advances the emitter particle simulation.

    Declaration

    Swift

    func advanceSimulationTime(_ sec: NSTimeInterval)

    Objective-C

    - (void)advanceSimulationTime:(NSTimeInterval)sec

    Parameters

    sec

    The number of seconds to simulate.

    Discussion

    Once added to a scene, an emitter node automatically creates new particles in new animation frames. This method allows you to artificially advance an emitter’s simulation, causing it to generate new particles and advance any existing particles. The most common use for this method is to prepopulate an emitter node with particles after it is first added to a scene.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The number of particles the emitter should emit before stopping.

    Declaration

    Swift

    var numParticlesToEmit: Int

    Objective-C

    @property(nonatomic) NSUInteger numParticlesToEmit

    Discussion

    The default value is 0, which indicates that emitter creates an endless stream of particles. If a non-zero value is provided, then the emitter stops generating particles after it has created the specified number of particles.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • Removes all existing particles and restarts the simulation.

    Declaration

    Swift

    func resetSimulation()

    Objective-C

    - (void)resetSimulation

    Discussion

    Resetting the simulation clears the internal state of the simulation.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The target node which renders the emitter’s particles.

    Declaration

    Swift

    weak var targetNode: SKNode?

    Objective-C

    @property(nonatomic, weak) SKNode *targetNode

    Discussion

    The default value is nil, which means that particles are treated as if they were children of the emitter node. In future frames of animation, the particle positions are affected by the emitter node’s properties. If you specify a different target node, the initial properties of new particles are calculated based on the emitter node’s properties, but in future frames of animation the particles are treated as if they were children of the target node.

    For example, assume you have an emitter node as a child of the scene node and the node is being rotated by changing its zRotation property. The behavior of the emitter node changes based on the value of the target node:

    • If the targetNode property is nil, then the positions of both previously generated and new particles are rotated.

    • If the targetNode property points to the scene node, then new particles are adjusted when the emitter node rotates, but previously generated particles are not.

    By spawning the particles inside the scene node, they have behavior independent of the emitter’s properties.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The average lifetime of a particle, in seconds.

    Declaration

    Swift

    var particleLifetime: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleLifetime

    Discussion

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The range of allowed random values for a particle’s lifetime.

    Declaration

    Swift

    var particleLifetimeRange: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleLifetimeRange

    Discussion

    The default value is 0.0. If non-zero, the lifetime of each particle is randomly determined and may vary by plus or minus half of the range value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    particleLifetime

  • The average starting position for a particle.

    Declaration

    Swift

    var particlePosition: CGPoint

    Objective-C

    @property(nonatomic) CGPoint particlePosition

    Discussion

    The default value is (0.0,0.0).

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The range of allowed random values for a particle’s position.

    Declaration

    Swift

    var particlePositionRange: CGVector

    Objective-C

    @property(nonatomic) CGVector particlePositionRange

    Discussion

    The default value is (0.0,0.0). If a component is non-zero, the same component of a particle’s position is randomly determined and may vary by plus or minus half of the range value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    particlePosition

  • The average starting depth of a particle.

    Declaration

    Swift

    var particleZPosition: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleZPosition

    Discussion

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The range of allowed random values for a particle’s depth.

    Declaration

    Swift

    var particleZPositionRange: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleZPositionRange

    Discussion

    The default value is 0.0. If non-zero, the z position of each particle is randomly determined and may vary by plus or minus half of the range value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    particlePosition

  • The average initial speed of a new particle in points per second.

    Declaration

    Swift

    var particleSpeed: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleSpeed

    Discussion

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The range of allowed random values for a particle’s initial speed.

    Declaration

    Swift

    var particleSpeedRange: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleSpeedRange

    Discussion

    The default value is 0.0. If non-zero, the speed of each particle is randomly determined and may vary by plus or minus half of the range value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    particleSpeed

  • The average initial direction of a particle, expressed as an angle in radians.

    Declaration

    Swift

    var emissionAngle: CGFloat

    Objective-C

    @property(nonatomic) CGFloat emissionAngle

    Discussion

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The range of allowed random values for a particle’s initial speed, expressed as an angle in radians.

    Declaration

    Swift

    var emissionAngleRange: CGFloat

    Objective-C

    @property(nonatomic) CGFloat emissionAngleRange

    Discussion

    The default value is 0.0. If non-zero, the emission angle of each particle is randomly determined and may vary by plus or minus half of the range value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    emissionAngle

  • The acceleration to apply to a particle’s horizontal velocity.

    Declaration

    Swift

    var xAcceleration: CGFloat

    Objective-C

    @property(nonatomic) CGFloat xAcceleration

    Discussion

    This property is useful for simulating wind, gravity and other effects. It is uniformly applied to all particles generated by the emitter.

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The acceleration to apply to a particle’s vertical velocity.

    Declaration

    Swift

    var yAcceleration: CGFloat

    Objective-C

    @property(nonatomic) CGFloat yAcceleration

    Discussion

    This property is useful for simulating wind, gravity and other effects. It is uniformly applied to all particles generated by the emitter.

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The speed at which the particle’s depth changes.

    Declaration

    Swift

    var particleZPositionSpeed: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleZPositionSpeed

    Discussion

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 8.0 and later.

  • The average initial rotation of a particle, expressed as an angle in radians.

    Declaration

    Swift

    var particleRotation: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleRotation

    Discussion

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The range of allowed random values for a particle’s initial rotation, expressed as an angle in radians.

    Declaration

    Swift

    var particleRotationRange: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleRotationRange

    Discussion

    The default value is 0.0. If non-zero, the initial rotation of each particle is randomly determined and may vary by plus or minus half of the range value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    particleRotation

  • The speed at which a particle rotates, expressed in radians per second.

    Declaration

    Swift

    var particleRotationSpeed: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleRotationSpeed

    Discussion

    This is uniform for all particles generated by the emitter. The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The sequence used to specify the scale factor of a particle over its lifetime.

    Declaration

    Swift

    var particleScaleSequence: SKKeyframeSequence?

    Objective-C

    @property(nonatomic, retain) SKKeyframeSequence *particleScaleSequence

    Discussion

    The default value is nil. If a non-nil value is specified, then the particleScale, particleScaleRange, and particleScaleSpeed properties are ignored. Instead, the sequence is used to specify the scale factor.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The average initial scale factor of a particle.

    Declaration

    Swift

    var particleScale: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleScale

    Discussion

    The default value is 1.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The range of allowed random values for a particle’s initial scale.

    Declaration

    Swift

    var particleScaleRange: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleScaleRange

    Discussion

    The default value is 0.0. If non-zero, the initial scale of each particle is randomly determined and may vary by plus or minus half of the range value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    particleScale

  • The rate at which a particle’s scale factor changes per second.

    Declaration

    Swift

    var particleScaleSpeed: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleScaleSpeed

    Discussion

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The texture to use to render a particle.

    Declaration

    Swift

    var particleTexture: SKTexture?

    Objective-C

    @property(nonatomic, retain) SKTexture *particleTexture

    Discussion

    A particle is rendered as if it were a SKSpriteNode object. The default value is nil, which means a colored rectangle is used to draw the particle. If a non-nil value is specified, then the texture is colorized and used to draw particles.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    particleSize

  • The starting size of each particle.

    Declaration

    Swift

    var particleSize: CGSize

    Objective-C

    @property(nonatomic) CGSize particleSize

    Discussion

    The default value is CGSizeZero. If set to the default, the size of the texture stored in the particleTexture property is used to determine the size of a particle. If a texture has not been assigned, you must set this property to a non-empty size.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    particleTexture

  • The sequence used to specify the color components of a particle over its lifetime.

    Declaration

    Swift

    var particleColorSequence: SKKeyframeSequence?

    Objective-C

    @property(nonatomic, retain) SKKeyframeSequence *particleColorSequence

    Discussion

    The default value is nil. If a non-nil value is specified, then the particleColor, particleColorAlphaRange, particleColorRedRange, particleColorGreenRange, particleColorBlueRange, particleColorAlphaSpeed, particleColorRedSpeed, particleColorGreenSpeed, and particleColorBlueSpeed properties are ignored. Instead, the sequence is used to specify the particle color.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The average initial color for a particle.

    Declaration

    Swift

    var particleColor: UIColor!

    Objective-C

    @property(nonatomic, retain) UIColor *particleColor

    Discussion

    The default value is [SKColor clearColor].

    A particle’s color is blended with the texture using its blend color factor. See Determining How the Particle Texture Is Blended with the Particle Color.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The range of allowed random values for the alpha component of a particle’s initial color.

    Declaration

    Swift

    var particleColorAlphaRange: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleColorAlphaRange

    Discussion

    The default value is 0.0. If non-zero, the starting alpha component of a particle’s color is randomly determined and may vary by plus or minus half of the range value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    particleColor

  • The range of allowed random values for the blue component of a particle’s initial color.

    Declaration

    Swift

    var particleColorBlueRange: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleColorBlueRange

    Discussion

    The default value is 0.0. If non-zero, the starting blue component of a particle’s color is randomly determined and may vary by plus or minus half of the range value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    particleColor

  • The range of allowed random values for the green component of a particle’s initial color.

    Declaration

    Swift

    var particleColorGreenRange: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleColorGreenRange

    Discussion

    The default value is 0.0. If non-zero, the starting green component of a particle’s color is randomly determined and may vary by plus or minus half of the range value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    particleColor

  • The range of allowed random values for the red component of a particle’s initial color.

    Declaration

    Swift

    var particleColorRedRange: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleColorRedRange

    Discussion

    The default value is 0.0. If non-zero, the starting red component of a particle’s color is randomly determined and may vary by plus or minus half of the range value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    particleColor

  • The rate at which the alpha component of a particle’s color changes per second.

    Declaration

    Swift

    var particleColorAlphaSpeed: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleColorAlphaSpeed

    Discussion

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The rate at which the blue component of a particle’s color changes per second.

    Declaration

    Swift

    var particleColorBlueSpeed: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleColorBlueSpeed

    Discussion

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The rate at which the green component of a particle’s color changes per second.

    Declaration

    Swift

    var particleColorGreenSpeed: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleColorGreenSpeed

    Discussion

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The rate at which the red component of a particle’s color changes per second.

    Declaration

    Swift

    var particleColorRedSpeed: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleColorRedSpeed

    Discussion

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The sequence used to specify the color blend factor of a particle over its lifetime.

    Declaration

    Swift

    var particleColorBlendFactorSequence: SKKeyframeSequence?

    Objective-C

    @property(nonatomic, retain) SKKeyframeSequence *particleColorBlendFactorSequence

    Discussion

    The default value is nil. If a non-nil value is specified, then the particleColorBlendFactor, particleColorBlendFactorRange, and particleColorBlendFactorSpeed properties are ignored. Instead, the sequence is used to specify the color blend factor.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The average starting value for the color blend factor.

    Declaration

    Swift

    var particleColorBlendFactor: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleColorBlendFactor

    Discussion

    The default value is 0.0, which means that the texture is used as is, ignoring the particle’s color. Otherwise, the texture is blended with the color.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The range of allowed random values for a particle’s starting color blend factor.

    Declaration

    Swift

    var particleColorBlendFactorRange: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleColorBlendFactorRange

    Discussion

    The default value is 0.0. If non-zero, the initial color blend factor of each particle is randomly determined and may vary by plus or minus half of the range value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The rate at which the color blend factor changes per second.

    Declaration

    Swift

    var particleColorBlendFactorSpeed: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleColorBlendFactorSpeed

    Discussion

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The blending mode used to blend particles into the framebuffer.

    Declaration

    Swift

    var particleBlendMode: SKBlendMode

    Objective-C

    @property(nonatomic) SKBlendMode particleBlendMode

    Discussion

    The default value is SKBlendModeAlpha.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The sequence used to specify the alpha value of a particle over its lifetime.

    Declaration

    Swift

    var particleAlphaSequence: SKKeyframeSequence?

    Objective-C

    @property(nonatomic, retain) SKKeyframeSequence *particleAlphaSequence

    Discussion

    The default value is nil. If a non-nil value is specified, then the particleAlpha, particleAlphaRange, and particleAlphaSpeed properties are ignored. Instead, the sequence is used to specify the alpha value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The average starting alpha value for a particle.

    Declaration

    Swift

    var particleAlpha: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleAlpha

    Discussion

    The particle alpha value is equivalent to the alpha property of the SKNode class. The alpha component of the color that results from the texture and color blending state is multiplied by a particle’s alpha value. The resulting particle color is then blended with the parent’s framebuffer. The default value is 1.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • The range of allowed random values for a particle’s starting alpha value.

    Declaration

    Swift

    var particleAlphaRange: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleAlphaRange

    Discussion

    The default value is 0.0. If non-zero, the initial alpha value of each particle is randomly determined and may vary by plus or minus half of the range value.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

    See Also

    particleAlpha

  • The rate at which the alpha value of a particle changes per second.

    Declaration

    Swift

    var particleAlphaSpeed: CGFloat

    Objective-C

    @property(nonatomic) CGFloat particleAlphaSpeed

    Discussion

    The default value is 0.0.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • Specifies an action executed by new particles.

    Declaration

    Swift

    @NSCopying var particleAction: SKAction?

    Objective-C

    @property(nonatomic, copy) SKAction *particleAction

    Discussion

    Adding complex actions to particles can severely impact the performance of the particle emitter. Also, because the particles do not exist as an explicit node that you can manipulate, you cannot remove the actions from existing particles.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 7.0 and later.

  • A mask that defines which categories of physics fields can exert forces on the particles.

    Declaration

    Swift

    var fieldBitMask: UInt32

    Objective-C

    @property(nonatomic, assign) uint32_t fieldBitMask

    Discussion

    When a particle is inside the region of a SKFieldNode object, that field node’s categoryBitMask property is compared to the emitter’s fieldBitMask property by performing a logical AND operation. If the result is a non-zero value, then the field node’s effect is applied to the particle as if it had a physics body. The physics body is assumed to have a mass of 1.0 and a charge of 1.0

    The default value is 0x00000000 (all bits cleared).

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 8.0 and later.

  • shader shader Property

    A custom shader used to determine how particles are rendered.

    Declaration

    Swift

    var shader: SKShader?

    Objective-C

    @property(nonatomic, retain) SKShader *shader

    Discussion

    The default value is nil. If a shader is specified, then the shader is used to determine the output colors for any of the emitter’s particles.

    Import Statement

    import SpriteKit

    Availability

    Available in iOS 8.0 and later.