Make any image fall like a snowflake! ❄️ Add Snowflake to any view layer for a cool animated affect.
view.backgroundColor = #colorLiteral(red: 0.1411764771, green: 0.3960784376, blue: 0.5647059083, alpha: 1)
let flake = #imageLiteral(resourceName: "flake")
let snowflake = Snowflake(view: view, particles: [flake: .white])
self.view.layer.addSublayer(snowflake)
snowflake.start()
snowflake.stop()
let flake = #imageLiteral(resourceName: "flake")
let snap = #imageLiteral(resourceName: "snap")
let redColor = #colorLiteral(red: 0.8078431487, green: 0.02745098062, blue: 0.3333333433, alpha: 1)
let yellowColor = #colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)
let flurry = Snowflake(view: view, particles: [flake: redColor , snap:yellowColor ])
Snowflake size is a scale from 0.0 to 1.0 (1.0 being the size of your original image) Changing the particlSize affects all snowflakes.
//Snowflake that is half its original size
snowflake.particleSizeRange = 0.5
To run the example project, clone the repo, and run pod install
from the Example directory first.
Snowflake is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Snowflake"
julp04, [email protected]
Snowflake is available under the MIT license. See the LICENSE file for more info.