Guest User

Untitled

a guest
Jan 17th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. private func animateCells() {
  2. if collectionView.visibleCells.count < indexToFlip { return }
  3. let numberOfCards = collectionView.visibleCells.count
  4. var currentIndex = 1
  5. var delayNextFlipMiliSeconds = 0
  6. for section in 0 ..< collectionView.numberOfSections {
  7. for row in 0 ..< collectionView.numberOfItems(inSection: section) {
  8. guard let cell = collectionView.cellForItem(at: IndexPath(row: row, section: section)) as? CardCell else { continue }
  9. print(delayNextFlipMiliSeconds)
  10. print(NSDate().timeIntervalSince1970)
  11. DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(delayNextFlipMiliSeconds)) {
  12. cell.flipCard() {
  13. currentIndex += 1
  14. if currentIndex == numberOfCards {
  15. UIView.animate(withDuration: 0.5, animations: {
  16. self.playButton.alpha = 1
  17. })
  18. }
  19. }
  20. }
  21. delayNextFlipMiliSeconds += 200
  22. }
  23. }
  24. }
  25.  
  26. 0
  27. 1547749398.849406
  28. 200
  29. 1547749398.850255
  30. 400
  31. 1547749398.850312
  32. 600
  33. 1547749398.850347
  34. 800
  35. 1547749398.8503752
  36. 1000
  37. 1547749398.850401
  38. 1200
  39. 1547749398.850429
  40. 1400
  41. 1547749398.850459
  42. 1600
  43. 1547749398.850482
  44. 1800
  45. 1547749398.850504
  46. 2000
  47. 1547749398.850525
  48. 2200
  49. 1547749398.850559
  50. 2400
  51. 1547749398.850597
  52. 2600
  53. 1547749398.85063
  54. 2800
  55. 1547749398.850657
  56. 3000
  57. 1547749398.850702
Add Comment
Please, Sign In to add comment