0

I'm trying to understand if any of the particle systems in iOS (Sprite Kit or CAEmitterLayer) are suitable for the task I have.

The question: is there a way to control when the emitter is creating particles? Particularly, telling the emitter when to emit and when to stop emitting.

Rationale: Basically I want to make a music equalizer (visualizer?) effect with particles. I thought of having an emitter for each frequency and make it create particles whose shape/speed differs depending on the signal strength of that frequency at that point of time.

Please let me know if this is possible with particles and if not then how to do it effectively (layers? views?). OpenGL is too low level.

frangulyan
  • 3,580
  • 4
  • 36
  • 64

1 Answers1

2

is there a way to control when the emitter is creating particles?

An emitter is a lightweight object that tells the emitter system (if I may call it that) to emit so long as it is present in the interface. To start and stop emitting an already configured emitter, the simplest approach is to place it in, or remove it from, the visible interface.

Of course, you could also simply change the value of the emitter's birthRate - an emitter with a zero birthRate is not emitting any particles. But the effect will not be as immediate as simply removing the emitter.

So it depends what you want. Removing the emitter removes all the particles, kaboom, and restoring the emitter to the interface also restores all particles, kaboom. In other words, the whole emission world associated with that emitter is removed or inserted. Changing the birthRate, on the other hand, simply turns the spigot off and on.

matt
  • 515,959
  • 87
  • 875
  • 1,141