CAEmitterLayer Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/QuartzCore.framework |
| Availability | Available in OS X v10.6 and later. |
| Declared in | CAEmitterLayer.h |
| Companion guides | |
Overview
The CAEmitterLayer class provides a particle emitter system for Core Animation. The particles are defined by instances of CAEmitterCell.
The particles are drawn above the layer’s background color and border
Tasks
Specifying Particle Emitter Cells
-
emitterCellsproperty
Emitter Geometry
-
renderModeproperty -
emitterPositionproperty -
emitterShapeproperty -
emitterZPositionproperty -
emitterDepthproperty -
emitterSizeproperty
Emitter Cell Attribute Multipliers
-
scaleproperty -
seedproperty -
spinproperty -
velocityproperty -
birthRateproperty -
emitterModeproperty -
lifetimeproperty -
preservesDepthproperty
Properties
birthRate
Defines a multiplier that is applied to the cell-defined birth rate. Animatable
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.
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hemitterCells
The array emitter cells attached to the layer.
Discussion
Each object in the array must be an instance of the CAEmitterCell class.
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hemitterDepth
Determines the depth of the emitter shape.
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.
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hemitterMode
Specifies the emitter mode.
Discussion
The possible values for emitterMode are shown in “Emitter Modes.” The default value is kCAEmitterLayerVolume.
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hemitterPosition
The position of the center of the particle emitter. Animatable.
Discussion
See “Emitter Shape” for details of how the emitterPosition relates to the possible emitter shapes.
Default is (0.0,0.0).
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hemitterShape
Specifies the emitter shape.
Discussion
The possible values for emitterMode are shown in “Emitter Shape.” The default value is kCAEmitterLayerPoint.
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hemitterSize
Determines the size of the particle emitter shape. Animatable.
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.
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hemitterZPosition
Specifies the center of the particle emitter shape along the z-axis. Animatable.
Discussion
See “Emitter Shape” for details of how the emitterZPosition relates to the possible emitter shapes.
Default is 0.0.
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hlifetime
Defines a multiplier applied to the cell-defined lifetime range when particles are created. Animatable.
Discussion
Default value is 1.0.
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hpreservesDepth
Defines whether the layer flattens its the particles into its plane.
Discussion
If YES, 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 NO.
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hrenderMode
Defines how particle cells are rendered into the layer.
Discussion
The possible values for render modes are shown in “Emitter Modes.” The default value is kCAEmitterLayerUnordered.
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hscale
Defines a multiplier applied to the cell-defined particle scale.
Discussion
Default value is 1.0.
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hseed
Specifies the seed used to initialize the random number generator.
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].
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hspin
Defines a multiplier applied to the cell-defined particle spin. Animatable.
Discussion
Default value is 1.0.
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hvelocity
Defines a multiplier applied to the cell-defined particle velocity. Animatable.
Discussion
Default value is 1.0.
Availability
- Available in OS X v10.6 and later.
Declared In
CAEmitterLayer.hConstants
Emitter Shape
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.
NSString * const kCAEmitterLayerPoint; NSString * const kCAEmitterLayerLine; NSString * const kCAEmitterLayerRectangle; NSString * const kCAEmitterLayerCuboid; NSString * const kCAEmitterLayerCircle; NSString * const kCAEmitterLayerSphere;
Constants
kCAEmitterLayerPointParticles are emitted from a single point at (
emitterPosition.x,emitterPosition.y,emitterZPosition)Available in OS X v10.6 and later.
Declared in
CAEmitterLayer.h.kCAEmitterLayerLineParticles 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.
Declared in
CAEmitterLayer.h.kCAEmitterLayerRectangleParticles 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.
Declared in
CAEmitterLayer.h.kCAEmitterLayerCuboidParticles 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.
Declared in
CAEmitterLayer.h.kCAEmitterLayerCircleParticles are emitted from a circle centered at (
emitterPosition.x,emitterPosition.y,emitterZPosition) of radiusemitterSize.width.Available in OS X v10.6 and later.
Declared in
CAEmitterLayer.h.kCAEmitterLayerSphereParticles are emitted from a sphere centered at (
emitterPosition.x,emitterPosition.y,emitterZPosition) of radiusemitterSize.width.Available in OS X v10.6 and later.
Declared in
CAEmitterLayer.h.
Emitter Modes
These constants specify the possible emitter modes. They are used by the emitterMode property.
NSString * const kCAEmitterLayerPoints; NSString * const kCAEmitterLayerOutline; NSString * const kCAEmitterLayerSurface; NSString * const kCAEmitterLayerVolume;
Constants
kCAEmitterLayerPointsParticles are emitted from points on the particle emitter.
Available in OS X v10.6 and later.
Declared in
CAEmitterLayer.h.kCAEmitterLayerOutlineParticles are emitted from the outline of the particle emitter.
Available in OS X v10.6 and later.
Declared in
CAEmitterLayer.h.kCAEmitterLayerSurfaceParticles are emitted from the surface of the particle emitter.
Available in OS X v10.6 and later.
Declared in
CAEmitterLayer.h.kCAEmitterLayerVolumeParticles are emitted from the a position within the particle emitter.
Available in OS X v10.6 and later.
Declared in
CAEmitterLayer.h.
Emitter Render Order
These constants specify the order that emitter cells are composited. They are used by the renderMode property.
NSString * const kCAEmitterLayerUnordered; NSString * const kCAEmitterLayerOldestFirst; NSString * const kCAEmitterLayerOldestLast; NSString * const kCAEmitterLayerBackToFront; NSString * const kCAEmitterLayerAdditive;
Constants
kCAEmitterLayerUnorderedParticles are rendered unordered. This mode uses source-over compositing.
Available in OS X v10.6 and later.
Declared in
CAEmitterLayer.h.kCAEmitterLayerOldestFirstParticles are rendered oldest first. This mode uses source-over compositing.
Available in OS X v10.6 and later.
Declared in
CAEmitterLayer.h.kCAEmitterLayerOldestLastParticles are rendered oldest last. This mode uses source-over compositing.
Available in OS X v10.6 and later.
Declared in
CAEmitterLayer.h.kCAEmitterLayerBackToFrontParticles are rendered from back to front, sorted by z-position. This mode uses source-over compositing.
Available in OS X v10.6 and later.
Declared in
CAEmitterLayer.h.kCAEmitterLayerAdditiveThe particles are rendered using source-additive compositing.
Available in OS X v10.6 and later.
Declared in
CAEmitterLayer.h.
© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-01-09)