Last active
January 6, 2019 10:42
-
-
Save laevandus/a8ecc1de70c4ed43be8dc6facc8d4fb2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension CAEmitterLayer { | |
convenience init(image: CGImage) { | |
self.init() | |
let cell: CAEmitterCell = { | |
let cell = CAEmitterCell() | |
cell.birthRate = 40 | |
cell.contents = image | |
cell.emissionLongitude = .pi / 2.0 | |
cell.emissionRange = CGFloat.pi / 4.0 | |
cell.lifetime = 16 | |
cell.scale = 0.3 | |
cell.scaleRange = 0.2 | |
cell.velocity = 80 | |
return cell | |
}() | |
emitterCells = [cell] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment