Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Самвел Меджлумян – Выходные с Лотти

CocoaHeads
December 22, 2017
140

Самвел Меджлумян – Выходные с Лотти

CocoaHeads

December 22, 2017
Tweet

More Decks by CocoaHeads

Transcript

  1. План доклада ❖ Про жизнь ❖ Инструменты в iOS ❖

    Про Лотти ❖ Мой кейс и проблемы ❖ Альтернативы и выводы 2
  2. Зачем ❖ Привлечь внимание к объекту ❖ Показать сценарий ❖

    Показать переходы ❖ Продемонстрировать завершённость 7
  3. Анимация как часть UX ❖ Имеют конкретную цель ❖ Являются

    частью вашего UI ❖ Не выбиваются и не раздражают 8
  4. OpenGL ❖ Добавить OpenGLES и QuartzCore ❖ Установить LayerClass для

    вашего view как CAEAGLLayer ❖ Создать OpenGL context ❖ Создать буфер для рендеринга ❖ Создать буфер кадра ❖ Определить метод render ❖ … 10
  5. 11

  6. 15

  7. 16 func positionAnimation(from: CGPoint, to: CGPoint) -> CABasicAnimation { let

    animation = CABasicAnimation(keyPath: "position") animation.fromValue = from animation.toValue = to animation.repeatCount = .infinity animation.autoreverses = true animation.duration = 0.5 return animation }
  8. CAKeyFrameAnimation 17 func shake() { let shake: CAKeyframeAnimation = CAKeyframeAnimation(keyPath:

    "transform") shake.values = [NSValue(caTransform3D: CATransform3DMakeTranslation(-6.0, 0.0, 0.0)), NSValue(caTransform3D: CATransform3DMakeTranslation(6.0, 0.0, 0.0))] shake.autoreverses = true shake.repeatCount = 2.0 shake.duration = 0.07 self.layer.add(shake, forKey: "shake") }
  9. CATransition 18 if animated { let animation = CATransition() animation.type

    = kCATransitionFade animation.duration = AnimationDuration.normal layer.add(animation, forKey: nil) }
  10. CAAnimationGroup 19 let positionAnimation = propertyAnimation(path: “position", duration: duration, toValue:

    position) let opacityAnimation = propertyAnimation(path: "opacity", duration: duration, toValue: opacity) let animationGroup = CAAnimationGroup() animationGroup.animations = [positionAnimation, opacityAnimation] animationGroup.duration = duration layer.add(animationGroup, forKey: nil)
  11. 24

  12. 25

  13. 26

  14. Зачем ❖ Размер анимации ❖ Мутация на лету ❖ Ресайз

    ❖ Интеграция с backend ❖ Меньше рутины при разработке 27
  15. 28

  16. 29

  17. 31