Instance Method

addModifierForProperties:atStage:withBlock:

Adds a block that modifies particle properties, to be executed each time SceneKit renders a frame.

Declaration

- (void)addModifierForProperties:(NSArray<SCNParticleProperty> *)properties atStage:(SCNParticleModifierStage)stage withBlock:(SCNParticleModifierBlock)block;

Parameters

properties

An array containing one or more of the constants listed in Particle Property Keys, each of which specifies a property of the appearance or behaviors of particles in the particle system.

stage

The stage of SceneKit’s particle simulation during which to call the block. See SCNParticleModifierStage for allowed values.

block

A SCNParticleModifierBlock block to be called every time SceneKit renders a frame. In this block you can modify the properties of all particles in the system.

Discussion

By associating a block with one or more particle properties, you can run arbitrary code that modifies those properties during each frame of animation. This option provides maximum flexibility for changing the appearance or behavior of particles over time.

See Also

Modifying Particles Over Time

propertyControllers

A dictionary that optionally associates particle properties with objects that animate a property’s value for each particle.

- removeModifiersOfStage:

Removes particle modifier blocks for the specified stage of the particle simulation.

- removeAllModifiers

Removes all particle modifier blocks associated with the particle system.

SCNParticleProperty

Keys identifying properties of individual particles, used by the propertyControllers dictionary and the handleEvent:forProperties:withBlock: and addModifierForProperties:atStage:withBlock: methods.

SCNParticleModifierStage

Stages of SceneKit’s particle simulation process into which you can insert modifier blocks, used by the addModifierForProperties:atStage:withBlock: method.

SCNParticleModifierBlock

The signature for blocks called by SceneKit to modify particle properties on each frame of simulation, used by the addModifierForProperties:atStage:withBlock: method.