我试图围绕它自己动画/旋转一个圆圈。 是我试过的,但它只是在整个屏幕上旋转..我不需要它移动,我只需要在现场旋转。 让circleLayer:CAShapeLayer!\在方法之外
vlet rotate = CABasicAnimation(keyPath: "transform.rotation.z")
rotate.fromValue = Float(0.0)
rotate.toValue = Float(2.0 * M_PI)
rotate.duration = 1.0
rotate.cumulative = true
rotate.repeatCount = 1
rotate.removedOnCompletion = false
rotate.fillMode = kCAFillModeForward
circleLayer.addAnimation(rotate, forKey: "transform.rotation.z")
任何想法为什么它会在现场移动和旋转/旋转?
答案 0 :(得分:0)
找到解决方案,我只是用不同的动画旋转视图本身:
UIView.animateWithDuration(0.95, delay: 0.0, options: UIViewAnimationOptions.CurveLinear, animations: { () -> Void in
self.circleView.transform = CGAffineTransformMakeRotation(self.sumer)
}, completion: nil)
享受