I wondering why when I try to animate the path
property of a CAShapeLayer
with a basic animation it works but when I try to do it with transaction it doesn't.
I've successfully animated other animatable
properties using just transaction. Here is my current code:
CATransaction.begin()
CATransaction.setAnimationDuration(2.0)
path = scalePath() // a scaled version of the original path
CATransaction.commit()
the new path is obtained scaling the original path with this (very hardcoded) function inside an extension of CAShapeLayer
:
func scalePath()->CGPath{
var scaleTransform = CGAffineTransform.identity.translatedBy(x: -150, y: -150)
scaleTransform = scaleTransform.scaledBy(x: 10, y: 10)
let newPath = path?.copy(using: &scaleTransform)
return newPath!
}
Can you identify any issue?