sudeepag / SAConfettiView

Confetti! Who doesn't like confetti?
MIT License
1.55k stars 268 forks source link

Initial position for confetti #20

Open HarshilShah opened 8 years ago

HarshilShah commented 8 years ago

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.

HarshilShah commented 8 years ago

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.

saulacher commented 8 years ago

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

GeorgeFedoseev commented 8 years ago

For me the solution was adding

    emitter.beginTime = CACurrentMediaTime();

to the startConfetti() method

sssbohdan commented 4 years ago

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.