I have a CAShapeLayer
that scales to an unknown scale number:
myCAShapeLayer.transform = CATransform3DMakeScale(newScale, newScale, 1)
Then at a certain point, I have to run a CABasicAnimation
from current scale back to 1:
let animation1 = CABasicAnimation(keyPath: "transform.scale")
animation1.fromValue = myCAShapeLayer.value(forKeyPath: "transform.scale") as! CGFloat
animation1.toValue = 1.0
animation1.duration = 0.5
myCAShapeLayer.add(animation1, forKey: nil)
when I log myCAShapeLayer.value(forKeyPath: "transform.scale") as! CGFloat
after each CATransform3DMakeScale
, its always 1.0, though visually the layer is scaled up.
I also tried myCAShapeLayer.presentation()?.value(forKeyPath: "transform.scale") as! CGFloat
and its also 1.0