Latest 0.2.0
Homepage https://github.com/dbukowski/Disintegrate
License MIT
Platforms ios 8.0
Authors

CI Status
Version
Carthage compatible
License
Platform
Twitter: @darekbukowski

Disintegrate is a small library providing an animation inspired by how our favorite heroes disappeared at the end of Avengers: Infinity War.
The view or layer that you use it on is divided into small triangles, which then move into one direction and fade away. You can customize the estimated number of triangles and the direction they will move to.

Disintegrate        
Disintegrate        
Disintegrate

Usage

Disintegrate adds a single method to both UIView and CALayer classes.

func disintegrate(direction: DisintegrationDirection = DisintegrationDirection.random(),
                  estimatedTrianglesCount: Int = 66,
                  completion: (() -> ())? = nil)

The animation can be customized by two parameters:

  • direction – direction in which the triangle particles will move. By default, the direction is chosen randomly from the set of 8 available options: up, down, left, right, upper left, upper right, lower left and lower right.
  • estimatedTrianglesCount – estimated number of triangle particles. Specifying it allows you to adjust the performance of the animation to your needs. For example, if you know that you want to use it on a smaller view, you can divide it into more triangles. Keep in mind, that it is only an estimate, and the final count of the triangles will also depend on the exact size of the view or the layer. This parameter does have an empirically chosen default value, so you don’t have to specify it.

Additionally, you can specify a completion block that will be executed when the animation finishes.

Here are some examples of using Disintegrate:

avatarImageView.disintegrate()
cancelButton.disintegrate(direction: .upperLeft)
gradientLayer.disintegrate(estimatedTrianglesCount: 100)
errorLabel.disintegrate(direction: .down, estimatedTrianglesCount: 200) {
    print("Error label animation finished.")
}

Installation

CocoaPods

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

pod 'Disintegrate'

Carthage

To integrate Disintegrate into your Xcode project using Carthage, specify it in your Cartfile:

github "dbukowski/Disintegrate" ~> 0.2.0

Run carthage update to build the framework and drag the built Disintegrate.framework into your Xcode project.

Manually

Alternatively, you can simply copy the 3 files from Disintegrate/Classes directory.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Disintegrate requires iOS 8.0 or later.

Author

Dariusz Bukowski, [email protected]

License

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

Latest podspec

{
    "name": "Disintegrate",
    "version": "0.2.0",
    "summary": "Disintegration animation inspired by THAT thing Thanos did at the end of Avengers: Infinity War.",
    "description": "Disintegrate is a small library providing an animation inspired by how our favorite heroes disappeared at the end of Avengers: Infinity War.n    The view or layer that you use it on is divided into small triangles, which then move into one direction and fade away. You can customizen    the estimated number of triangles and the direction they will move to.",
    "homepage": "https://github.com/dbukowski/Disintegrate",
    "screenshots": [
        "https://i.imgur.com/kPXjfNP.png",
        "https://i.imgur.com/bz7zFez.png",
        "https://i.imgur.com/EnYu6uJ.png",
        "https://i.imgur.com/bNWiGrD.png",
        "https://i.imgur.com/kytYTMT.png"
    ],
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Dariusz Bukowski": "[email protected]"
    },
    "source": {
        "git": "https://github.com/dbukowski/Disintegrate.git",
        "tag": "0.2.0"
    },
    "social_media_url": "https://twitter.com/darekbukowski",
    "platforms": {
        "ios": "8.0"
    },
    "swift_version": "4.2",
    "source_files": "Disintegrate/Classes/**/*"
}

Pin It on Pinterest

Share This