0

我试图了解 iOS 中的任何粒子系统(Sprite Kit 或 CAEmitterLayer)是否适合我的任务。

问题:有没有办法控制发射器何时创建粒子?特别是,告诉发射器何时发射以及何时停止发射。

理由:基本上我想用粒子制作音乐均衡器(可视化器?)效果。我想为每个频率设置一个发射器,并让它产生形状/速度不同的粒子,具体取决于该频率在该时间点的信号强度。

请让我知道这是否可以使用粒子,如果不能,那么如何有效地做到这一点(图层?视图?)。OpenGL 级别太低。

4

1 回答 1

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.

于 2016-03-20T00:10:14.387 回答