Skip to content

A beautiful activity indicator to show that a task is in progress

License

Notifications You must be signed in to change notification settings

pandaApe/HLTrafficLightsIndicatorView

Repository files navigation

HLTrafficLightsIndicatorView

Version License Platform

Example

Result

Animated gif

Layers

Animated gif

Timeline

Animated gif

Vibration for runway layer

Animated gif

In iOS9 Apple finally made the CASpringAnimation class public, we can simplly create an attractive spring animation effecting CALayer. But our indicator view must be compatible with iOS8+. To archive the subtle effects for runway layer, we should dig out little physics knowledge, that is the Vibration.

Pls check reference bellow:

Requirements

  • Swift 3.0+
  • iOS 8.0+
  • Xcode 8.0+

Installation

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

pod "HLTrafficLightsIndicatorView"

Usage example

Inited from pure code :

let view = HLTrafficLightsIndicatorView(frame: CGRect(x: 100, y: 100, width: 200, height: 200))
        
self.view.addSubview(view)
        

Customization Properties

open var topRingColor        = UIColor.red
open var centerRingColor     = UIColor(red: 255/255, green: 192/255, blue: 1/255, alpha: 1)
open var bottomRingColor     = UIColor(red: 18/255, green: 222/255, blue: 125/255, alpha: 1)
open var runwayColor         = UIColor(red: 6/255, green: 122/255, blue: 240/255, alpha: 1)

open var duration: Double = 1.2 

TODO

The runway layer need enable spring animation.

Author

pandaApe, whailong2010@gmail.com

License

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

About

A beautiful activity indicator to show that a task is in progress

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published