UIImageView
subclass that performs slow translation and scale animations on its image.
You perform random translation and scale animations with beginDriftAnimations()
:
imageView.beginDriftAnimations()
You perform a custom animation by using the DriftAnimationTraits
struct:
let traits = self.buildDriftAnimationTraits(imageView
, repeats: true
, zoomOut: false
, minZoom: 1.0
, maxZoom: 2.0
, minPointsPerSec: 4
, maxPointsPerSec: 5)
DriftAnimationImageView.addDriftAnimations(imageView, traits: traits, completion: nil)
You perform random translation and scale animations on a series of images with performDriftAnimations()
:
imageView.performDriftAnimations(["image0", "image1"])
You remove an ongoing animation with removeDriftAnimations()
:
imageView.removeDriftAnimations()
To run the example project, clone the repo, and run pod install
from the Example directory first.
DriftAnimationImageView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "DriftAnimationImageView"
DriftAnimationImageView is available under the MIT license. See the LICENSE file for more info.