Is it possible to use enhanced key path (as described here) for a CATransform3D property in Swift 3 with new #keyPath keyword?
In other words to replace
let scaleAnimation = CABasicAnimation(keyPath: "transform.scale")
with something like
let scaleAnimation = CABasicAnimation(keyPath: #keyPath(CALayer.transform.???))
CAValueFunction should be used.
let scaleAnimation = CABasicAnimation(keyPath: "transform.scale")
->
let scaleAnimation = CABasicAnimation(keyPath: #keyPath(CALayer.transform))
scaleAnimation.valueFunction = CAValueFunction(name: kCAValueFunctionScale)
and
let rotationAnimation = CABasicAnimation(keyPath: "transform.rotation")
->
let rotationAnimation = CABasicAnimation(keyPath: #keyPath(CALayer.transform))
rotationAnimation.valueFunction = CAValueFunction(name: kCAValueFunctionRotateZ)
etc.
rotation.x -> kCAValueFunctionRotateX
rotation.y -> kCAValueFunctionRotateY
rotation.z -> kCAValueFunctionRotateZ
rotation -> kCAValueFunctionRotateZ
scale.x -> kCAValueFunctionScaleX
scale.y -> kCAValueFunctionScaleY
scale.z -> kCAValueFunctionScaleZ
scale -> kCAValueFunctionScale
translation.x -> kCAValueFunctionTranslateX
translation.y -> kCAValueFunctionTranslateY
translation.z -> kCAValueFunctionTranslateZ
translation -> kCAValueFunctionTranslate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With