A UICollectionViewLayout subclass that adds custom transitions/animations to the UICollectionView without effecting your existing code.
Swift Ruby Objective-C
Latest commit cddea2f Feb 22, 2017 @KelvinJin Added a new animator to demonstrate the ability to animate cells in a…
… normal collection view list.

README.md

AnimatedCollectionViewLayout

Normally a UICollectionView has no transition effects when you scroll from one item to another. There are lots of ways to write animations for UICollectionView, but using a UICollectionViewLayout subclass is by far the simplest one. And it doesn't break any of your existing code. You can still use your UICollectionView subclass and you don't need to change your UICollectionViewCell. Just plug and enjoy.

CI Status

Parallax ZoomInOut RotateInOut Cards
CrossFade Cube Page

Example

To run the example project, clone the repo, and start iOS Example in Xcode.

Requirements

  • iOS 8.0+

Installation

CocoaPods

To integrate AnimatedCollectionViewLayout into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'AnimatedCollectionViewLayout'

Usage

Get Started

Import the library where you want to use it. Create a AnimatedCollectionViewLayout object, set its animator and assign it to your UICollectionView.

import AnimatedCollectionViewLayout

// ...

let layout = AnimatedCollectionViewLayout()
layout.animator = ParallaxAttributesAnimator()
collectionView.collectionViewLayout = layout

Customization

Animators implement the protocol LayoutAttributesAnimator. Most of the built-in ones have additional parameters that you can tweak the transitions. You can also write your own animators.

TODO

  • Support non-paging mode.
  • Support non-full screen items.
  • Support item selection notifications.

Author

Jin Wang

License

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