【发布时间】:2020-08-08 15:30:55
【问题描述】:
我有一个以父视图为中心的圆形 CAShapeLayered UIView。现在,当我点击此视图时,我想将其整体半径增加 50%。因此,我将以下动画代码附加到我的图层。
private func getLargerLayerAnimation()->CABasicAnimation {
let animation = CABasicAnimation(keyPath: "transform.scale")
animation.fromValue = 1
animation.toValue = 1.5
animation.duration = 2.0
animation.autoreverses = true
animation.fillMode = .forwards
animation.isRemovedOnCompletion = true
return animation
}
但不是从中心放大图层,而是向右下方移动。如何保持中心不变并扩大圆形层。
【问题讨论】:
标签: ios transform cashapelayer cabasicanimation