CAEmitterCell does not respect the duration value

我是研究僧i 提交于 2019-12-04 19:54:17

You can do this with a timer, and a method to stop the emitter generating new particles...

At the end of your existing code add:

    [newEmitter setName:@"newEmitter"];
    [NSTimer scheduledTimerWithTimeInterval:2.0
                                     target:self
                                   selector:@selector(stopEmitter:)
                                   userInfo:nil
                                    repeats:NO];

Then make a stopEmitter: method…

    - (void) stopEmitter:(NSTimer*)timer
    {
        [emitter setValue:@0
               forKeyPath:@"emitterCells.newEmitter.birthRate"];
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!