Created
July 31, 2021 20:26
-
-
Save sujinnaljin/e22002681b30c27a31dfc2f348dc4a86 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| func addSnowLayer() { | |
| let cell = CAEmitterCell() | |
| cell.contents = UIImage(named: "EmojiTwo")!.cgImage | |
| cell.birthRate = 5 | |
| cell.lifetime = 10 | |
| cell.scale = 0.1 | |
| cell.yAcceleration = 100 | |
| cell.alphaSpeed = -0.2 | |
| let emitterLayer = CAEmitterLayer() | |
| emitterLayer.emitterShape = .line | |
| emitterLayer.emitterSize = CGSize(width: view.frame.width, | |
| height: view.frame.height) | |
| emitterLayer.emitterPosition = CGPoint(x: view.center.x, | |
| y: .zero) | |
| emitterLayer.emitterCells = [cell] | |
| view.layer.addSublayer(emitterLayer) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment