Skip to content

Instantly share code, notes, and snippets.

@saru2020
Last active October 18, 2019 20:13
Show Gist options
  • Save saru2020/b3fb36847a0f447be8e218c881b68d82 to your computer and use it in GitHub Desktop.
Save saru2020/b3fb36847a0f447be8e218c881b68d82 to your computer and use it in GitHub Desktop.
UIView.animateKeyframes(withDuration: 5, //1
delay: 0, //2
options: .calculationModeLinear, //3
animations: { //4
UIView.addKeyframe( //5
withRelativeStartTime: 0.25, //6
relativeDuration: 0.25) { //7
self.button.center = CGPoint(x: self.view.bounds.midX, y: self.view.bounds.maxY) //8
}
UIView.addKeyframe(withRelativeStartTime: 0.5, relativeDuration: 0.25) {
self.button.center = CGPoint(x: self.view.bounds.width, y: start.y)
}
UIView.addKeyframe(withRelativeStartTime: 0.75, relativeDuration: 0.25) {
self.button.center = start
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment