Particles 0.2.0

Particles 0.2.0

Maintained by Wyatt Mufson, Ross Krasner, Wyatt Mufson.



Particles 0.2.0

  • By
  • WyattMufson

Particles

Build Status codecov Version License Platform

Particles is a native swift adaption of particles.js and inspired by this stackoverflow question.

Installation

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

pod 'Particles'

Usage

You must import the Particles pod.

import Particles

let particlesView = ParticlesView(frame: view.frame)
view.addSubview(particlesView)

You can also initialize the ParticlesView with three optional parameters:

var bgColor: UIColor = .clear                 // The color of the background of the view
var particlesColor: UIColor = .black          // The color of the particles and the lines connecting them
var density: ParticleDensity = .extraLight    // How densely packed the view is with particles
var speed: ParticleSpeed = .normal            // How fast the particles are moving

The ParticleDensity enum has five cases:

.extraLight
.light
.normal
.dense
.extraDense

The ParticleSpeed enum has three cases:

.quick
.normal
.slow

bgColor, particlesColor, density and speed can be changed after initializaiton. Changing density will not cause the particles to be relayed out, but will either add or remove the needed amount of particles based on the new density.

Example

An example project is available in the ParticlesExample target to demonstrate the capabilities.

The default ParticlesView look like this (with the black background and white particles color):

defaultparticles

It can be customized to your specific liking, such as like this (with a blue background and red particles color):

customparticles

License

Particles is available under the MIT license.