Skip to content

Instantly share code, notes, and snippets.

@akshitzaveri
Created May 2, 2020 11:34
Show Gist options
  • Save akshitzaveri/a9c21741ee6717edd8974106cc5d90f6 to your computer and use it in GitHub Desktop.
Save akshitzaveri/a9c21741ee6717edd8974106cc5d90f6 to your computer and use it in GitHub Desktop.
private func animate(view: UIView, path: UIBezierPath) {
// 1
let animation = CAKeyframeAnimation(keyPath: "position")
// 2
animation.path = path.cgPath
// 3
animation.repeatCount = 1
// 4
animation.duration = 5
// 5
view.layer.add(animation, forKey: "animation")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment