Mac Developer Library

Developer

QuartzCore Framework Reference CAEmitterLayer Class Reference

Options
Deployment Target:

On This Page
Language:

CAEmitterLayer

The CAEmitterLayer class provides a particle emitter system for Core Animation. The particles are defined by instances of CAEmitterCell. More...

Inheritance


Import Statement


import QuartzCore @import QuartzCore;

Availability


Available in OS X v10.6 and later.
  • The array emitter cells attached to the layer.

    Declaration

    Swift

    var emitterCells: [AnyObject]!

    Objective-C

    @property(copy) NSArray *emitterCells

    Discussion

    Each object in the array must be an instance of the CAEmitterCell class.

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • Defines how particle cells are rendered into the layer.

    Declaration

    Swift

    var renderMode: String!

    Objective-C

    @property(copy) NSString *renderMode

    Discussion

    The possible values for render modes are shown in Emitter Modes. The default value is kCAEmitterLayerUnordered.

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • The position of the center of the particle emitter. Animatable.

    Declaration

    Swift

    var emitterPosition: CGPoint

    Objective-C

    @property CGPoint emitterPosition

    Discussion

    See Emitter Shape for details of how the emitterPosition relates to the possible emitter shapes.

    Default is (0.0,0.0).

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • Specifies the emitter shape.

    Declaration

    Swift

    var emitterShape: String!

    Objective-C

    @property(copy) NSString *emitterShape

    Discussion

    The possible values for emitterMode are shown in Emitter Shape. The default value is kCAEmitterLayerPoint.

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • Specifies the center of the particle emitter shape along the z-axis. Animatable.

    Declaration

    Swift

    var emitterZPosition: CGFloat

    Objective-C

    @property CGFloat emitterZPosition

    Discussion

    See Emitter Shape for details of how the emitterZPosition relates to the possible emitter shapes.

    Default is 0.0.

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • Determines the depth of the emitter shape.

    Declaration

    Swift

    var emitterDepth: CGFloat

    Objective-C

    @property CGFloat emitterDepth

    Discussion

    How the emitter depth is applied depends on the emitter shape. See Emitter Shape for details. Depending on the value of emitterShape, this value may be ignored.

    Default is 0.0.

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • Determines the size of the particle emitter shape. Animatable.

    Declaration

    Swift

    var emitterSize: CGSize

    Objective-C

    @property CGSize emitterSize

    Discussion

    How the emitter size is applied depends on the emitter shape. See Emitter Shape for details. Depending on the value of emitterShape, this value may be ignored.

    Default is 0.0.

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • scale scale Property

    Defines a multiplier applied to the cell-defined particle scale.

    Declaration

    Swift

    var scale: Float

    Objective-C

    @property float scale

    Discussion

    Default value is 1.0.

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • seed seed Property

    Specifies the seed used to initialize the random number generator.

    Declaration

    Swift

    var seed: UInt32

    Objective-C

    @property unsigned int seed

    Discussion

    Each layer has its own random number generator state. Emitter cell properties that are defined as a mean and a range, such as a cell’s speed, the value of the properties are uniformly distributed in the interval [M - R/2, M + R/2].

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • spin spin Property

    Defines a multiplier applied to the cell-defined particle spin. Animatable.

    Declaration

    Swift

    var spin: Float

    Objective-C

    @property float spin

    Discussion

    Default value is 1.0.

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • velocity velocity Property

    Defines a multiplier applied to the cell-defined particle velocity. Animatable.

    Declaration

    Swift

    var velocity: Float

    Objective-C

    @property float velocity

    Discussion

    Default value is 1.0.

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • birthRate birthRate Property

    Defines a multiplier that is applied to the cell-defined birth rate. Animatable

    Declaration

    Swift

    var birthRate: Float

    Objective-C

    @property float birthRate

    Discussion

    The birth rate of each cell is multiplied by this number to give the actual number of particles created every second. Default value is 1.0.

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • Specifies the emitter mode.

    Declaration

    Swift

    var emitterMode: String!

    Objective-C

    @property(copy) NSString *emitterMode

    Discussion

    The possible values for emitterMode are shown in Emitter Modes. The default value is kCAEmitterLayerVolume.

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • lifetime lifetime Property

    Defines a multiplier applied to the cell-defined lifetime range when particles are created. Animatable.

    Declaration

    Swift

    var lifetime: Float

    Objective-C

    @property float lifetime

    Discussion

    Default value is 1.0.

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • Defines whether the layer flattens the particles into its plane.

    Declaration

    Swift

    var preservesDepth: Bool

    Objective-C

    @property BOOL preservesDepth

    Discussion

    If YEStrue, the layer renders its particles as if they directly inhabit the three-dimensional coordinate space of the layer’s superlayer. When enabled, the effect of the layer’s filters, backgroundFilters, and shadow related properties is undefined.

    Default is NOfalse.

    Import Statement

    import QuartzCore

    Availability

    Available in OS X v10.6 and later.

  • The emission shape is a one, two or three dimensional shape that defines where the emitted particles originate. The shapes are defined by a subset of emitterPosition, emitterZPosition, emitterSize and emitterDepth properties.

    Declaration

    Swift

    let kCAEmitterLayerPoint: NSString! let kCAEmitterLayerLine: NSString! let kCAEmitterLayerRectangle: NSString! let kCAEmitterLayerCuboid: NSString! let kCAEmitterLayerCircle: NSString! let kCAEmitterLayerSphere: NSString!

    Objective-C

    NSString * const kCAEmitterLayerPoint; NSString * const kCAEmitterLayerLine; NSString * const kCAEmitterLayerRectangle; NSString * const kCAEmitterLayerCuboid; NSString * const kCAEmitterLayerCircle; NSString * const kCAEmitterLayerSphere;

    Constants

    • kCAEmitterLayerPoint

      kCAEmitterLayerPoint

      Particles are emitted from a single point at (emitterPosition.x, emitterPosition.y, emitterZPosition)

      Available in OS X v10.6 and later.

    • kCAEmitterLayerLine

      kCAEmitterLayerLine

      Particles are emitted along a line from (emitterPosition.x - emitterSize.width/2, emitterPosition.y, emitterZPosition) to (emitterPosition.x + emitterSize.width/2, emitterPosition.y, emitterZPosition).

      Available in OS X v10.6 and later.

    • kCAEmitterLayerRectangle

      kCAEmitterLayerRectangle

      Particles are emitted from a rectangle with opposite corners [emitterPosition.x - emitterSize.width/2, emitterPosition.y - emitterSize.height/2, emitterZPosition], [emitterPosition.x + emitterSize.width/2, emitterPosition.y + emitterSize.height/2, emitterZPosition].

      Available in OS X v10.6 and later.

    • kCAEmitterLayerCuboid

      kCAEmitterLayerCuboid

      Particles are emitted from a cuboid (3D rectangle) with opposite corners: [emitterPosition.x - emitterSize.width/2, emitterPosition.y - emitterSize.height/2, emitterZPosition - emitterDepth/2], [emitterPosition.x + emitterSize.width/2, emitterPosition.y + emitterSize.height/2, emitterZPosition+emitterDepth/2].

      Available in OS X v10.6 and later.

    • kCAEmitterLayerCircle

      kCAEmitterLayerCircle

      Particles are emitted from a circle centered at (emitterPosition.x, emitterPosition.y, emitterZPosition) of radius emitterSize.width.

      Available in OS X v10.6 and later.

    • kCAEmitterLayerSphere

      kCAEmitterLayerSphere

      Particles are emitted from a sphere centered at (emitterPosition.x, emitterPosition.y, emitterZPosition) of radius emitterSize.width.

      Available in OS X v10.6 and later.

    Import Statement

  • These constants specify the possible emitter modes. They are used by the emitterMode property.

    Declaration

    Swift

    let kCAEmitterLayerPoints: NSString! let kCAEmitterLayerOutline: NSString! let kCAEmitterLayerSurface: NSString! let kCAEmitterLayerVolume: NSString!

    Objective-C

    NSString * const kCAEmitterLayerPoints; NSString * const kCAEmitterLayerOutline; NSString * const kCAEmitterLayerSurface; NSString * const kCAEmitterLayerVolume;

    Constants

    • kCAEmitterLayerPoints

      kCAEmitterLayerPoints

      Particles are emitted from points on the particle emitter.

      Available in OS X v10.6 and later.

    • kCAEmitterLayerOutline

      kCAEmitterLayerOutline

      Particles are emitted from the outline of the particle emitter.

      Available in OS X v10.6 and later.

    • kCAEmitterLayerSurface

      kCAEmitterLayerSurface

      Particles are emitted from the surface of the particle emitter.

      Available in OS X v10.6 and later.

    • kCAEmitterLayerVolume

      kCAEmitterLayerVolume

      Particles are emitted from the a position within the particle emitter.

      Available in OS X v10.6 and later.

    Import Statement

  • These constants specify the order that emitter cells are composited. They are used by the renderMode property.

    Declaration

    Swift

    let kCAEmitterLayerUnordered: NSString! let kCAEmitterLayerOldestFirst: NSString! let kCAEmitterLayerOldestLast: NSString! let kCAEmitterLayerBackToFront: NSString! let kCAEmitterLayerAdditive: NSString!

    Objective-C

    NSString * const kCAEmitterLayerUnordered; NSString * const kCAEmitterLayerOldestFirst; NSString * const kCAEmitterLayerOldestLast; NSString * const kCAEmitterLayerBackToFront; NSString * const kCAEmitterLayerAdditive;

    Constants

    • kCAEmitterLayerUnordered

      kCAEmitterLayerUnordered

      Particles are rendered unordered. This mode uses source-over compositing.

      Available in OS X v10.6 and later.

    • kCAEmitterLayerOldestFirst

      kCAEmitterLayerOldestFirst

      Particles are rendered oldest first. This mode uses source-over compositing.

      Available in OS X v10.6 and later.

    • kCAEmitterLayerOldestLast

      kCAEmitterLayerOldestLast

      Particles are rendered oldest last. This mode uses source-over compositing.

      Available in OS X v10.6 and later.

    • kCAEmitterLayerBackToFront

      kCAEmitterLayerBackToFront

      Particles are rendered from back to front, sorted by z-position. This mode uses source-over compositing.

      Available in OS X v10.6 and later.

    • kCAEmitterLayerAdditive

      kCAEmitterLayerAdditive

      The particles are rendered using source-additive compositing.

      Available in OS X v10.6 and later.

    Import Statement