You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, if you want to animate backgroundColor with CABasicAnimation, you need to consider type because fromValue property and so on are Any?.
If you use BasicAnimation of TheAnimation, you can animate backgroundColor without considering type! (AnimationKeyPaths.backgroundColor is AnimationKeyPath<CGColor> type.)
Usage
The way of making an animation is almost similar CAAnimation.
But you need to use animation.animate(in:) method instead of using layer.add(_:forKey:).
You can handle animation did Start with func setAnimationDidStart(handler:).
In addition, you can handle animation did Stop with func setAnimationDidStop(handler:).
letview=UIView()letanimation=BasicAnimation(keyPath:.opacity)
animation.fromValue =0
animation.toValue =1
animation.duration =1
animation.setAnimationDidStart{
// do something
}
animation.setAnimationDidStop{ finished in
// do something
}
animation.animate(in: view)
Requirements
Xcode 9.3
iOS 9 or greater
tvOS 9 or greater
macOS 10.11 or greater
Swift 4.2 (since 0.3.0)
Installation
Carthage
If you’re using Carthage, simply add
TheAnimation to your Cartfile:
github"marty-suzuki/TheAnimation"
CocoaPods
TheAnimation is available through CocoaPods. To install
it, simply add the following line to your Podfile: