Last active
March 12, 2017 01:12
-
-
Save efremidze/a0f3b9174e69d5945ace86d4e26c0e72 to your computer and use it in GitHub Desktop.
CABasicAnimation with `keyPath` value set to `fromValue`
This file contains hidden or 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: - CABasicAnimation | |
extension CABasicAnimation { | |
/// Creates a new animation object with its `keyPath` property set to `path` and current `keyPath` value set to `fromValue`. | |
convenience init(keyPath path: String, layer: CALayer) { | |
self.init(keyPath: path) | |
self.fromValue = layer.presentation()?.value(forKeyPath: path) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment