当我将动画摇入标记中时,我看到动画在其帧尺寸之外时被剪切了。我设置的活动:
marker.iconView?.layer.masksToBounds = true
然后是动画功能:
let shakeAnimation = CABasicAnimation(keyPath: #keyPath(CALayer.position))
shakeAnimation.duration = 0.3
shakeAnimation.repeatCount = HUGE
shakeAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn)
shakeAnimation.autoreverses = true
shakeAnimation.fromValue = NSValue(cgPoint: CGPoint(x:view.center.x, y:view.center.y))
shakeAnimation.toValue = NSValue(cgPoint: CGPoint(x:view.center.x, y:view.center.y + 6))
marker.iconView?.layer.add(shakeAnimation, forKey: #keyPath(CALayer.position))
我在这里更新了图片
有人可以帮忙吗?