ViewAnimator is a library for building complex iOS UIView animations in an easy way. It provides one line animations for any view included the ones which contain other views like UITableView and UICollectionView with its cells or UIStackView with its arrangedSubviews.
ViewAnimator provides a set of UIView extensions to easily add custom animations to your views. From version 2.0.0 there are two ways to use this extension.
Self animating views
Views can animate theirselves calling .animate(animations: [Animation]) that’s the most basic usage. Here’s the full method that contains many default arguments:
ViewAnimator follows the UIKit animations API style with a static method UIView.animate(views: [UIView], animations: [Animation]). This makes the library really easy to use and extensible to any kind of view. As the previous example, the method contains a lot of default arguments:
Animation protocol provides you the posibility of expanding the animations supported by ViewAnimator with exception of the animateRandom function.
public protocol Animation {
var initialTransform: CGAffineTransform { get }
}
UITableView/UICollection extensions
ViewAnimator comes with a set of handy extensions to make your animations in UITableView and UICollectionView a lot simpler. They both have access to cells in a section to animate easily.
They both expose a method visibleCells(in section: Int) that returns an array of UITableViewCell or UICollectionViewCell.
let cells = tableView.visibleCells(in: 1)
UIView.animate(views: cells, animations: [rotateAnimation, fadeAnimation])
ViewAnimator is a library for building complex iOS UIView animations in an easy way. It provides one line animations for any view included the ones which contain other views like UITableView and UICollectionView with its cells or UIStackView with its arrangedSubviews.
Entire View UITableView UICollectionView
SVG animations inspired by Luke Zhao’s project Hero
Complex Layouts
UI created by Messaki, make sure to check out his profile.
Logo and banner created by @cintia_ve
Installation
CocoaPods
ViewAnimator is available through CocoaPods. To install it, simply add the following line to your Podfile:
Manual
Drop the swift files inside of ViewAnimator/Classes into your project.
Carthage
Usage
ViewAnimator
provides a set ofUIView
extensions to easily add custom animations to your views. From version2.0.0
there are two ways to use this extension.Self animating views
Views can animate theirselves calling
.animate(animations: [Animation])
that’s the most basic usage. Here’s the full method that contains many default arguments:Animating multiple views
ViewAnimator follows the UIKit animations API style with a static method
UIView.animate(views: [UIView], animations: [Animation])
. This makes the library really easy to use and extensible to any kind of view. As the previous example, the method contains a lot of default arguments:AnimationType
Direction
Direction
provides the axis where the animation should take place and its movement direction.Zoom
Zoom in and Zoom out animation support.
Combined Animations
You can combine conformances of
Animation
to apply multiple transforms on your animation block.Animation
Animation
protocol provides you the posibility of expanding the animations supported byViewAnimator
with exception of theanimateRandom
function.UITableView/UICollection extensions
ViewAnimator comes with a set of handy extensions to make your animations in
UITableView
andUICollectionView
a lot simpler. They both have access to cells in a section to animate easily.They both expose a method
visibleCells(in section: Int)
that returns an array ofUITableViewCell
orUICollectionViewCell
.Mentions
Project Details
Requirements
Contributing
Feel free to collaborate with ideas 💭, issues ⁉️ and/or pull requests 🔃.
If you use ViewAnimator in your app I’d love to hear about it and feature your animation here!
Contributors
Author
Marcos Griselli |
@marcosgriselli
License
ViewAnimator is available under the MIT license. See the LICENSE file for more info.