Created
April 11, 2018 13:35
-
-
Save sourleangchhean168/d4d366dca52ff4932dd8becf36271eea to your computer and use it in GitHub Desktop.
CollectionView Cell Animation in Swift 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cell = collectionView.cellForItem(at: indexPath) | |
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: [], | |
animations: { | |
cell!.transform = CGAffineTransform(scaleX: 0.9, y: 0.9) | |
}, | |
completion: { finished in | |
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: .curveEaseInOut, | |
animations: { | |
cell!.transform = CGAffineTransform(scaleX: 1, y: 1) | |
}, | |
completion: nil | |
) | |
} | |
) | |
//Ref: https://codepad.co/snippet/vE7tduOt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment