CABasicAnimation example
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
// MARK: Position Animation | |
let positionAnimation = CABasicAnimation(keyPath: #keyPath(CALayer.position)) | |
positionAnimation.fromValue = CGPoint(x: -20, y: 100) | |
positionAnimation.toValue = CGPoint(x: 280, y: 100) | |
positionAnimation.duration = globalDuration | |
positionAnimation.repeatCount = globalRepeatCount | |
positionAnimation.autoreverses = true | |
// MARK: Add Animation to Layer | |
view.layer.add(positionAnimation, forKey: #keyPath(CALayer.position)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment