Skip to content

A collection of intricate geometric ActivityIndicator animations that add pizzaz to your projects.

License

Notifications You must be signed in to change notification settings

oct0f1sh/GeometricActivityIndicator

Repository files navigation

GeometricActivityIndicator

CI Status Version License Platform

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.

shapes

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.

storyboard

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 Duration

// changes the stencil animation duration to 3 seconds
geometricView.stencilAnimDuration = 3.0
// changes the shape animation duration to 5 seconds
geometricView.shapeAnimDuration = 5.0

Changing 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.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

Author

oct0f1sh, [email protected]

License

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

About

A collection of intricate geometric ActivityIndicator animations that add pizzaz to your projects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published