0
我需要帮助我有这段代码这是做循环路径,但我需要的是直线我试图做到这一点,但不成功。swift中的直线路径
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
let orbit = CAKeyframeAnimation(keyPath: "position")
var affineTransform = CGAffineTransformMakeRotation(0.0)
affineTransform = CGAffineTransformRotate(affineTransform, CGFloat(M_PI))
let circlePath = UIBezierPath(arcCenter: CGPoint(x: 150 - (100/2),y: 150 - (100/2)), radius: CGFloat(150), startAngle: CGFloat(0), endAngle:CGFloat(M_PI * 2), clockwise: true)
orbit.circlePath = path.CGPath
orbit.duration = 8
orbit.additive = true
orbit.repeatCount = 0.25
orbit.calculationMode = kCAAnimationPaced
orbit.rotationMode = kCAAnimationRotateAuto
moveobj.layer .addAnimation(orbit, forKey: "orbit")
}
和更多的一个问题如何做到这一点后消失完成移动。
谢谢
我把这个放在哪里?我不想画直线我想直线移动对象可以哟帮助我请。谢谢 – dinis
已经解决了谢谢 – dinis