CAEmitterLayer emits random unwanted particles on touch events

后端 未结 3 1388
灰色年华
灰色年华 2021-02-01 14:01

I\'m trying to set up a CAEmitterLayer to make a confetti effect, and I\'ve run into two issues:

  1. Whenever I set the birthRate on my cell
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-01 14:54

    I know this is an old post, but I also had this problem. Jackslash answers it well in this post: iOS 7 CAEmitterLayer spawning particles inappropriately

    You need to set beginTime on your emitter layer to begin at the current time with CACurrentMediaTime(). It seems the problem we have occurs because the emitter started already in the past.

    emitter.beginTime = CACurrentMediaTime();
    

提交回复
热议问题