SwiftyAnimate alternatives and similar libraries
Based on the "Animation" category.
Alternatively, view SwiftyAnimate alternatives based on common mentions on social networks and blogs.
-
Pop
DISCONTINUED. An extensible iOS and OS X animation library, useful for physics-based interactions. -
IBAnimatable
Design and prototype customized UI, interaction, navigation, transition and animation for App Store ready Apps in Interface Builder with IBAnimatable. -
Keyframes
DISCONTINUED. A library for converting Adobe AE shape based animations to a data format and play it back on Android and iOS devices. -
EasyAnimation
A Swift library to take the power of UIView.animateWithDuration(_:, animations:...) to a whole new level - layers, springs, chain-able animations and mixing view and layer animations together! -
ZoomTransitioning
ZoomTransitioning provides a custom transition with image zooming animation and swiping the screen edge. -
AHDownloadButton
Customizable download button with progress and transition animations. It is based on Apple's App Store download button. -
SamuraiTransition
SamuraiTransition is an open source Swift based library providing a collection of ViewController transitions featuring a number of neat “cutting” animations. -
CCMRadarView
CCMRadarView uses the IBDesignable tools to make an easy customizable radar view with animation -
ADPuzzleAnimation
Inspired by Fabric - Answers animation. Allows to "build" given view with pieces. Allows to "destroy" given view into pieces
SaaSHub - Software Alternatives and Reviews
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SwiftyAnimate or a related project?
README
Composable animations in Swift. Blog
Installation
Cocoapods
The easiest way to get started is to use CocoaPods. Just add the following line to your Podfile:
pod 'SwiftyAnimate', '~> 1.3.0'
Carthage
github "rchatham/SwiftyAnimate"
Swift Package Manager
Add the following line to your Package.swift file.
.Package(url: "https://github.com/rchatham/SwiftyAnimate.git", majorVersion: 0)
Usage
This library can be used to design composable animations while keeping animation code readable and maintainable.
Composing Animations
Compose animations and insert logic inbetween them using the then
, do
, and wait
functions.
Then blocks
Add animations to the current instance using one of the implementations for this function. There are implemetations for spring and keyframe animations as well as chaining Animate
objects together.
Animate(duration: 1.0) {
// animation code goes here
}
.then(duration: 0.5) {
// more animation code
}
.perform()
And blocks
Add animations to the current instance using one of the implementations for this function. There are implemetations for spring and keyframe animations as well as stacking Animate
objects together. 'And' animations are performed in sync with the animation before it.
Animate(duration: 1.0) {
// animation code goes here
}
.and(duration: 0.5) {
// more animation code
}
.perform()
Do blocks
Add code that you don't intend on animating but would like to perform between animations here. Any code you put here will NOT be animated.
Animate(duration: 1.0) {
// animation code goes here
}
.do {
// logic you don't want to animate
}
.then(duration: 0.5) {
// more animation code
}
.perform()
Wait blocks
Add code that you may want to pause an ongoing chain of animations for. Any code you put here will NOT be animated. You can pass in a timeout if you want to wait for a specific amount of time or if you don't want to wait longer to execute the code in the wait block.
Animate(duration: 1.0) {
// animation code goes here
}
.wait(timeout: 5.0) { resume in
// logic you want to pause an animation to complete
resume()
}
.then(duration: 0.5) {
// more animation code
}
.perform()
Performing Animations
There are two ways to perform animations finish
and perform
. Important: You must either call one of these two functions or decay
on an animation instance or this will result in a memory leak!
Perform
This one is easy. Call this on an animation instance to perform it. Perform takes an optional closure which gets excecuted on completing the last animation block.
let animation = Animate(duration: 1.0) {
// animations
}
animation.perform()
Finish
If you don't need to pass in a completion closure try calling finish on your animation instance. The animation passed in is enqueue'd and then perform is called on the instance. Finish has all of the same variations as the then function.
Animate(duration: 1.0) {
// animations
}
.finish(duration: 1.0) {
// animations
}
Decay
If you would like to deallocate an animation instance without performing it call decay on it.
let animation = Animate(duration: 1.0) {
// animations
}
animation.decay()
UIView Extensions
A number of animatable properties have extensions defined to make implementing them with this library even easier. Please check the docs!
Best Practices
The best way to take advantage of this library is define extensions for the views that you would like to animate. This compartmentailizes your code and keep all the animation logic tucked up within the view and out of your view controllers.
extension AnimatingView {
func bounceAnimation() -> Animate {
return Animate()
.then(animation: scale(duration: 0.3, x: 1.3, y: 1.3))
.then(animation: scale(duration: 0.3, x: 0.8, y: 0.8))
.then(animation: scale(duration: 0.3, x: 1.1, y: 1.1))
.then(animation: scale(duration: 0.3, x: 1.0, y: 1.0))
}
}
Then when you go to perform an animation you just have to call perform()
on the returned animation.
let animatingView = AnimatingView()
animatingView.bounceAnimation().perform()
And string them together with other animations for building up complex animation logic easily.
Animate()
.then(animation: animatingView.bounceAnimation())
.then(animation: animatingView.tiltAnimation())
.then(animation: animatingView.bounceAnimation())
.perform()
Contributing
I would love to see your ideas for improving this library! The best way to contribute is by submitting a pull request. I'll do my best to respond to your patch as soon as possible. You can also submit a new GitHub issue if you find bugs or have questions. 🙏
Please make sure to follow our general coding style and add test coverage for new features!
*Note that all licence references and agreements mentioned in the SwiftyAnimate README section above
are relevant to that project's source code only.