GeometricActivityIndicator is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'GeometricActivityIndicator'
To run the example project, clone the repo, and run pod install
from the Example directory first.
The animations included in GeometricActivityIndicator are based upon Metatron's Solids/Sacred Geometry.
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.
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()
}
}
// changes the stencil animation duration to 3 seconds
geometricView.stencilAnimDuration = 3.0
// changes the shape animation duration to 5 seconds
geometricView.shapeAnimDuration = 5.0
// changes stencil animation and shape animation to start and end at the same time with a duration of 3 seconds
geometricView.stencilAnimDuration = 3.0
geometricView.stencilAnimFromValue = 0.0
geometricView.stencilAnimToValue = 1.0
geometricView.shapeAnimDuration = 3.0
geometricView.shapeAnimFromValue = 0.0
geometricView.shapeAnimToValue = 1.0
// 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.0
geometricView.shapeAnimDuration = 1.5
geometricView.shapeAnimFromValue = -2.0
geometricView.shapeAnimToValue = 1.5
oct0f1sh, [email protected]
GeometricActivityIndicator is available under the MIT license. See the LICENSE file for more info.