【发布时间】:2017-08-22 02:29:25
【问题描述】:
我想知道为什么当我尝试使用基本动画为CAShapeLayer 的path 属性设置动画时,它可以工作,但是当我尝试使用事务时却不行。
我已经成功地使用事务为其他animatable 属性设置了动画。这是我当前的代码:
CATransaction.begin()
CATransaction.setAnimationDuration(2.0)
path = scalePath() // a scaled version of the original path
CATransaction.commit()
新路径是在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!
}
您能找出任何问题吗?
【问题讨论】:
标签: ios core-animation calayer cgpath ios-animations