From 90f3e572ed06af0cc9688fa75fa7de3c21075049 Mon Sep 17 00:00:00 2001 From: Jin Wang Date: Thu, 23 Feb 2017 11:51:52 +1100 Subject: [PATCH] Added documentations to explain the three offset values. Updated ready. --- README.md | 10 ++-------- Source/AnimatedCollectionViewLayout.swift | 5 +++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ebbd1ba..92cb18a 100644 --- a/README.md +++ b/README.md @@ -67,14 +67,8 @@ 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. +Most of the built-in animators work best in **Paging** mode and they have additional parameters that you can tweak for better transitions. +You can also write your own animators by implementing the protocol `LayoutAttributesAnimator`. ## Author diff --git a/Source/AnimatedCollectionViewLayout.swift b/Source/AnimatedCollectionViewLayout.swift index e6da28b..9c22543 100644 --- a/Source/AnimatedCollectionViewLayout.swift +++ b/Source/AnimatedCollectionViewLayout.swift @@ -77,8 +77,13 @@ public class AnimatedCollectionViewLayoutAttributes: UICollectionViewLayoutAttri public var contentView: UIView? public var scrollDirection: UICollectionViewScrollDirection = .vertical + /// The ratio of the distance between the start of the cell and the start of the collectionView and the height/width of the cell depending on the scrollDirection. It's 0 when the start of the cell aligns the start of the collectionView. It gets positive when the cell moves towards the scrolling direction (right/down) while getting negative when moves opposite. public var startOffset: CGFloat = 0 + + /// The ratio of the distance between the center of the cell and the center of the collectionView and the height/width of the cell depending on the scrollDirection. It's 0 when the center of the cell aligns the center of the collectionView. It gets positive when the cell moves towards the scrolling direction (right/down) while getting negative when moves opposite. public var middleOffset: CGFloat = 0 + + /// The ratio of the distance between the **start** of the cell and the end of the collectionView and the height/width of the cell depending on the scrollDirection. It's 0 when the **start** of the cell aligns the end of the collectionView. It gets positive when the cell moves towards the scrolling direction (right/down) while getting negative when moves opposite. public var endOffset: CGFloat = 0 public override func copy(with zone: NSZone? = nil) -> Any {