Last active
September 3, 2022 21:14
-
-
Save Anik0808/0da9d882879164832dd9d3aaa5c43e4f 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
let layer = CALayer() | |
layer.backgroundColor = UIColor.red.cgColor | |
layer.frame = CGRect(x: 0, y: 0, width: 200, height: 100) | |
animationView.layer.addSublayer(layer) | |
var transform = CATransform3DIdentity | |
transform = CATransform3DRotate(transform, (180 * .pi / 180), 0, 1, 0) | |
let animation = CABasicAnimation(keyPath: "transform") | |
animation.duration = 2 | |
animation.toValue = transform | |
animation.fillMode = .forwards | |
animation.isRemovedOnCompletion = false | |
layer.add(animation, forKey: UUID().description) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment