Shake Animation, shake button, shake button with animation (кнопка с анимацией) - Swift 5
Учись программировать на практических примерах, под руководством преподавателя
подробнее
@IBAction func buttonNextAction(_ sender: UIButton) {
let animation = CABasicAnimation(keyPath: "position")
animation.duration = 0.07
animation.repeatCount = 4
animation.autoreverses = true
animation.fromValue = NSValue(cgPoint: CGPoint(x: sender.center.x - 10, y: sender.center.y))
animation.toValue = NSValue(cgPoint: CGPoint(x: sender.center.x + 10, y: sender.center.y))
sender.layer.add(animation, forKey: "position")
}
Возврат к списку