sudeepag/SAConfettiView

Initial position for confetti

HarshilShah opened this issue · 4 comments

Is it possible to have the confetti drop in from the top when starting? Calling startConfetti() right now just shows a screen with a lot of confetti in random positions, which is pretty jarring. New confetti appear from the top after that, so it would be cool if they initially had the same origin.

Okay I did some digging around and turns out if you modify the lifetime of the emitter and not the birthrate for starting and stopping, this behaves as I’m proposing.

It is possible, just set emitter.emitterShape = kCAEmitterLayerLine and confetti will start drop from the top.

For me the solution was adding

    emitter.beginTime = CACurrentMediaTime();

to the startConfetti() method

For me after adding emitter.beginTime = CACurrentMediaTime();animation started behave really weird and working one in three/five times. In general, it seems bug by Apple, because before iOS 7 emitter was always starting from the initial position.