Update the passcode lock view

This commit is contained in:
Yishi Lin 2019-09-29 00:28:46 +08:00
parent 35f599c45b
commit c4f0462d43
6 changed files with 63 additions and 16 deletions

View file

@ -20,4 +20,14 @@ extension UITextField {
objc_setAssociatedObject(self, &kAssociationKeyNextField, newField, .OBJC_ASSOCIATION_RETAIN)
}
}
func shake() {
let animation = CAKeyframeAnimation(keyPath: "transform.translation.x")
animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear)
animation.repeatCount = 3
animation.duration = 0.2/TimeInterval(animation.repeatCount)
animation.autoreverses = true
animation.values = [3, -3]
layer.add(animation, forKey: "shake")
}
}