【发布时间】:2020-03-01 14:56:00
【问题描述】:
我完全按照这个:https://developer.apple.com/documentation/scenekit/animation/animating_scenekit_content
我在另一个具有用户面部几何形状的 SCNNode 上有一个 SCNNode。
面部 SCNNode 上的 SCNNode,我希望运动具有动画效果。我正在调用这个函数,它位于我想要动画的 SCNNode 的子类中。它所占用的属性是面上的一个位置。这个功能根本不起作用:
func move(to vertex: SCNVector3) {
let animation = CABasicAnimation(keyPath: "move")
animation.fromValue = SCNVector3(self.position.x, self.position.y, self.position.z)
animation.toValue = vertex
animation.duration = 3.0
self.addAnimation(animation, forKey: "move")
}
这个功能非常好用:
func move(to vertex: SCNVector3) {
self.position.x = vertex.x
self.position.y = vertex.y
self.position.z = vertex.z
}
两个函数的函数调用:
move(to: SCNVector3(anchor.geometry.vertices[Node.oldVertexPos].x, anchor.geometry.vertices[Node.oldVertexPos].y, anchor.geometry.vertices[Node.oldVertexPos].z))
【问题讨论】:
标签: ios swift animation cabasicanimation scnnode