Git Product home page Git Product logo

emitteruicomponents's Introduction

Emitter UI Components

Emitter UI Components is an iOS project written in Swift which provides a small set of common UI components customised with the UIKit provided particle emitter layer by using the custom emitter layer EmitterLayer. Such custom layer is a subclass of CAEmitterLayer and is used in the following custom UI components:

  • EmitterView: a subclass of UIView which layerClass is EmitterLayer and implements the protocol EmitterUIProtocol
  • EmitterTextField: a subclass of UITextField which layerClass is EmitterLayer and implements the protocol EmitterUIProtocol
  • EmitterButton: a subclass of UIButton which layerClass is EmitterLayer and implements the protocol EmitterUIProtocol
  • EmitterTabBar_experimental: (Experimental) is a revisited subclass of UITabBar
  • EmitterTabBarItem_experimental: (Experimental) is a revisited subclass of UITabBarItem and implements the protocol EmitterUIProtocol
  • EmitterSlider_experimental: (Experimental) is a revisited subclass of UITabBar and implements the protocol EmitterUIProtocol

The EmitterLayer layer can be applied to any UIView-based component.

The project provides a convenient protocol to be used for UI components called EmitterUIProtocol, exposing following properties:

  • animateParticles: Whether the particle emitter should start or not
  • particlesAnimationDuration: Updates the particles animation duration with which the emitter position moves along the path
  • particlesAnimationPathType: Updates the particles animation path type with which the emitter position moves
  • particlesColors: The particles colors to be used in the particle emitters
  • particleRadius: The radius to be used as base size for each particle in the system
  • particleVelocity: The initial velocity to be used for each particle in the system

Sample usage:

@IBOutlet weak var myTextfield: EmitterTextField!
   
func setupTextField(){
   //self.myTextfield.animateWithFirstResponder = false // specific for EmitterTextField component
   
   // Set the emitter position animation duration to 5 seconds
   self.myTextfield.particlesAnimationDuration = 5.0
   // Set the path type to be ovalIn related to the UI component rect
   self.myTextfield.particlesAnimationPathType = .ovalIn
   // Set the particle radius of each emitter cell
   self.myTextfield.particleRadius = 10.0
   // Set the colors which will be used to randomly generate emitter cell
   self.myTextfield.particlesColors = [.green, .white, .red]
   // Set the emitter cells initial velocity at the creation time
   self.myTextfield.particleVelocity = 20.0
   // Start animating the particles on the UI component
   self.myTextfield.animateParticles = true
}

Demo:

emitteruicomponents's People

Contributors

lucaiaco avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.