Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seedante/CardAnimation
Card flip animation by pan gesture.
https://github.com/seedante/CardAnimation
Last synced: 7 days ago
JSON representation
Card flip animation by pan gesture.
- Host: GitHub
- URL: https://github.com/seedante/CardAnimation
- Owner: seedante
- License: mit
- Created: 2015-10-08T15:21:25.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-01-20T11:55:02.000Z (almost 4 years ago)
- Last Synced: 2024-11-29T06:37:52.204Z (14 days ago)
- Language: Swift
- Homepage:
- Size: 2.42 MB
- Stars: 1,175
- Watchers: 29
- Forks: 127
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - CardAnimation - Card flip animation by pan gesture. (UI / Cards)
- awesome-ios-star - CardAnimation - Card flip animation by pan gesture. (UI / Cards)
README
# CardAnimation
[Design from Dribble](https://dribbble.com/shots/1265487-First-shot-in-Chapps-Animation).
![Design from Dribble](https://upload-images.jianshu.io/upload_images/37334-a93069b40b9a83d6.gif?imageMogr2/auto-orient/strip|imageView2/2/w/800)[实现思路在这里](http://www.jianshu.com/p/286222d4edf8)。
## Two Solutions
At the begin, I didn't encapsulate code, [@luxorules](https://github.com/luxorules/CardAnimation/tree/Component) refactor code into class and improve it to support not only image, then I encapsulate my code
into class. So, there are two choices.#### CardContainerView by seedante
Here is [CardContainerView API reference](https://seedante.github.io/CardAnimation/Classes/CardContainerView.html). [CardContainerView](https://github.com/seedante/CardAnimation/blob/master/Classes/CardContainerView.swift) supports custom card size, pan gesture.
Example:
let cardContainerView = CardContainerView(frame: aFrame)// with defalut card size.
cardContainerView.dataSource = id
Done.public protocol CardContainerDataSource: class{
func numberOfCards(for cardContainerView: UICardContainerView) -> Int
func cardContainerView(_ cardContainerView: UICardContainerView, imageForCardAt index: Int) -> UIImage?
}#### CardAnimationView by @luxorules
[CardAnimationView](https://github.com/seedante/CardAnimation/blob/master/Classes/CardAnimationView.swift) supports custom card size, pan gesture.
Usage is simple also:
let cardAnimationView = CardAnimationView.init(frame: aFrame)// with defalut card size.
cardAnimationView.dataSourceDelegate = idIt adds a little complexity to exchange for: custom card view(not only image).
protocol CardAnimationViewDataSource : class {
func numberOfVisibleCards() -> Int
func numberOfCards() -> Int
// Return view displayed in the CardAnimationView. If reusedView is not nil,
// you could configure and return it to reuse it.
func cardNumber(number:Int, reusedView:BaseCardView?) -> BaseCardView
}Classes:
- CardAnimationView: UIView, the view to display a list of card view.
- BasedCardView: UIView, all custom card view must be inherited from this class.
- ImageCardView: BasedCardView, child class of BasedCardView, if you just want to use image, use this class.## Requirements
* iOS 8.0/Swift 4.0
## Installation
Two solutions are both single file. They are in `Classes` folder. Just need to import file into your project.
## Other
The project is released under the [MIT LICENSE](https://github.com/seedante/CardAnimation/blob/master/LICENSE). And relative technical points are moved to [wiki](https://github.com/seedante/CardAnimation/wiki/CardAnimation-Technical-Point).