Last active
January 1, 2019 13:16
-
-
Save myrickchow32/7629f905c2cb26bbe9f6fbe7a416435a 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
// All animations are done with the same length of duration --- 1.0 second | |
let durationOfAnimationInSecond = 1.0 | |
func curveAnimation(view: UIView, animationOptions: UIView.AnimationOptions, isReset: Bool) { | |
let defaultXMovement: CGFloat = 240 | |
UIView.animate(withDuration: durationOfAnimationInSecond, delay: 0, options: animationOptions, animations: { | |
view.transform = isReset ? .identity : CGAffineTransform.identity.translatedBy(x: defaultXMovement, y: 0) | |
}, completion: nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment