【发布时间】:2017-09-06 08:01:19
【问题描述】:
我有一个球体并设法旋转它。但不幸的是,沿着错误的轴线。
我的目标是像地球一样沿 x 轴旋转。你能帮我申请一下吗?
这是我现有的代码:
let spin = CABasicAnimation(keyPath: "rotation")
// Use from-to to explicitly make a full rotation around z
spin.fromValue = NSValue(scnVector4: SCNVector4(x: 1, y: 0, z: 0, w: 0))
spin.toValue = NSValue(scnVector4: SCNVector4(x: 1, y: 0, z: 0, w: Float(CGFloat(-2 * Double.pi))))
spin.duration = 30
spin.repeatCount = .infinity
sphereNode.addAnimation(spin, forKey: "spin around")
【问题讨论】:
标签: swift augmented-reality arkit cabasicanimation