Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private func animateCells() {
- if collectionView.visibleCells.count < indexToFlip { return }
- let numberOfCards = collectionView.visibleCells.count
- var currentIndex = 1
- var delayNextFlipMiliSeconds = 0
- for section in 0 ..< collectionView.numberOfSections {
- for row in 0 ..< collectionView.numberOfItems(inSection: section) {
- guard let cell = collectionView.cellForItem(at: IndexPath(row: row, section: section)) as? CardCell else { continue }
- print(delayNextFlipMiliSeconds)
- print(NSDate().timeIntervalSince1970)
- DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(delayNextFlipMiliSeconds)) {
- cell.flipCard() {
- currentIndex += 1
- if currentIndex == numberOfCards {
- UIView.animate(withDuration: 0.5, animations: {
- self.playButton.alpha = 1
- })
- }
- }
- }
- delayNextFlipMiliSeconds += 200
- }
- }
- }
- 0
- 1547749398.849406
- 200
- 1547749398.850255
- 400
- 1547749398.850312
- 600
- 1547749398.850347
- 800
- 1547749398.8503752
- 1000
- 1547749398.850401
- 1200
- 1547749398.850429
- 1400
- 1547749398.850459
- 1600
- 1547749398.850482
- 1800
- 1547749398.850504
- 2000
- 1547749398.850525
- 2200
- 1547749398.850559
- 2400
- 1547749398.850597
- 2600
- 1547749398.85063
- 2800
- 1547749398.850657
- 3000
- 1547749398.850702
Add Comment
Please, Sign In to add comment