Last active
November 13, 2017 08:10
-
-
Save cjinghong/943891a5605bab6320abd6eccd02aae8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@objc func handlePan(_ gesture: UIPanGestureRecognizer) { | |
let location = gesture.location(in: self.view) | |
// To figure out the fraction completed, take the x location of the touch, | |
// and divide it by the maximum x the finger can move to (which is the screen's width) | |
let fractionCompleted = location.x / self.view.bounds.width | |
// Changing this property changes the % complete of the animation. | |
// Try experimenting with a different fraction and see what you get | |
animator.fractionComplete = fractionCompleted | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment