diff --git a/Sources/ConfettiKit/ConfettiView.swift b/Sources/ConfettiKit/ConfettiView.swift index 7059872..8db8e27 100644 --- a/Sources/ConfettiKit/ConfettiView.swift +++ b/Sources/ConfettiKit/ConfettiView.swift @@ -39,7 +39,13 @@ public final class ConfettiView: UIView { extension ConfettiView: ShootingDelegate { func shootingDidFinish(_ shooting: Shooting) { - shooting.view?.removeFromSuperview() - shootings.removeAll { $0 === shooting } + guard let view = shooting.view else { return } + + UIView.animate(withDuration: 0.5, animations: { + view.alpha = 0.0 + }, completion: { _ in + view.removeFromSuperview() + self.shootings.removeAll { $0 === shooting } + }) } } diff --git a/Sources/ConfettiKit/Internal/ConfettiLayerView.swift b/Sources/ConfettiKit/Internal/ConfettiLayerView.swift index bf1f82e..a9377ee 100644 --- a/Sources/ConfettiKit/Internal/ConfettiLayerView.swift +++ b/Sources/ConfettiKit/Internal/ConfettiLayerView.swift @@ -85,6 +85,7 @@ private extension ConfettiLayerView { cell.scale = scale cell.scaleRange = scaleRange cell.speed = speed + cell.alphaSpeed = -0.4 cell.emissionLongitude = degreesToRadians(180) cell.emissionRange = degreesToRadians(90) cell.contents = image.cgImage