项目作者: julpanucci

项目描述 :
Let it snow ❄️
高级语言: Shell
项目地址: git://github.com/julpanucci/Snowflake.git
创建时间: 2017-08-23T17:31:51Z
项目社区:https://github.com/julpanucci/Snowflake

开源协议:MIT License

下载


Snowflake

CI Status
Version
License
Platform

About

Make any image fall like a snowflake! ❄️ Add Snowflake to any view layer for a cool animated affect.

Alt text

Setup

  1. view.backgroundColor = #colorLiteral(red: 0.1411764771, green: 0.3960784376, blue: 0.5647059083, alpha: 1)
  2. let flake = #imageLiteral(resourceName: "flake")
  3. let snowflake = Snowflake(view: view, particles: [flake: .white])
  4. self.view.layer.addSublayer(snowflake)

Start

  1. snowflake.start()

Stop

  1. snowflake.stop()

Add multiple particles

  1. let flake = #imageLiteral(resourceName: "flake")
  2. let snap = #imageLiteral(resourceName: "snap")
  3. let redColor = #colorLiteral(red: 0.8078431487, green: 0.02745098062, blue: 0.3333333433, alpha: 1)
  4. let yellowColor = #colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)
  5. let flurry = Snowflake(view: view, particles: [flake: redColor , snap:yellowColor ])

Alt text

Change Flake Size

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.

  1. //Snowflake that is half its original size
  2. snowflake.particleSizeRange = 0.5

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

Snowflake is available through CocoaPods. To install
it, simply add the following line to your Podfile:

  1. pod "Snowflake"

Author

julp04, julpanucci@gmail.com

License

Snowflake is available under the MIT license. See the LICENSE file for more info.