快速标记摇动动画->动画时标记被剪切

时间:2018-08-11 09:12:03

标签: swift marker shake

当我将动画摇入标记中时,我看到动画在其帧尺寸之外时被剪切了。我设置的活动:

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))

我在这里更新了图片

enter image description here

有人可以帮忙吗?

0 个答案:

没有答案