GeometricActivityIndicator
Installation
GeometricActivityIndicator is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'GeometricActivityIndicator'Example
To run the example project, clone the repo, and run pod install from the Example directory first.
Animations
The animations included in GeometricActivityIndicator are based upon Metatron's Solids/Sacred Geometry.
Usage
Storyboard
Implementing GeometricActivityIndicator in your project is as setting a custom class for a UIView. Many of the properties are editable using the Attributes Inspector.
In your ViewController:
// create an IBOutlet for your new GeometricActivityIndicator
@IBOutlet weak var geometricView: GeometricActivityIndicator!
// now you can start / stop animating
override func viewDidLoad() {
geometricView.startAnimating()
}
@IBAction func stopButtonTapped(_ sender: Any) {
geometricView.stopAnimating()
}Important: GeometricActivityIndicator is a subclass of UIView, not UIActivityIndicatorView, make sure you set the custom class for the correct element.
Programmatically
class ViewController: UIViewController {
var geometricView: GeometricActivityIndicator!
override func viewDidLoad() {
geometricView = GeometricActivityIndicator(frame: CGRect(x: 0, y: 0, width: 250, height: 250))
geometricView.startAnimating()
}
@IBAction func stopButtonTapped(_ sender: Any) {
geometricView.stopAnimating()
}
}Customization
Changing Animation Timing
Changing Duration
// changes the stencil animation duration to 3 seconds
geometricView.stencilAnimDuration = 3// changes the shape animation duration to 5 seconds
geometricView.shapeAnimDuration = 5Changing Animation Timing
// changes stencil animation and shape animation to start and end at the same time with a duration of 3 seconds
geometricView.stencilAnimDuration = 3
geometricView.stencilAnimFromValue = 0
geometricView.stencilAnimToValue = 1
geometricView.shapeAnimDuration = 3
geometricView.shapeAnimFromValue = 0
geometricView.shapeAnimToValue = 1// this is the default duration and timing for the stencil and shape animations
// note: these are the default values when creating a GeometricActivityIndicator.
// these values produce the animations shown above
geometricView.stencilAnimDuration = 1.5
geometricView.stencilAnimFromValue = -0.5
geometricView.stencilAnimToValue = 2
geometricView.shapeAnimDuration = 1.5
geometricView.shapeAnimFromValue = -2
geometricView.shapeAnimToValue = 1.5Author
oct0f1sh, [email protected]
License
GeometricActivityIndicator is available under the MIT license. See the LICENSE file for more info.


