我有一個對象,在初始化期間創建一個幾何。如何在SCNNode上爲自定義屬性設置動畫效果?
class Helix {
var width: GLfloat // x
var height: GLfloat // y
var depth: GLfloat // z
var radius: GLfloat
var pitchInherent: GLfloat
var pitchCurrent: GLfloat
/* Other SceneKit related properties used later */
init(width: Float, height: Float, depth: Float) {
/* Geometry logic */
geometry = SCNGeometry(sources: [vertexSource], elements: [element])
}
func getNode() -> SCNNode {
return SCNNode(geometry: geometry)
}
}
然後在我的視圖控制器中,我將它添加到節點樹中。
let scene = SCNScene()
let helix = Helix(width: 30, height: 30, depth: 30)
let helixNode = helix.getNode()
scene.rootNode.addChildNode(helixNode)
我想動畫pitchCurrent
屬性。在定製CALayer
對象的世界中,我用來指定那些我想動畫的屬性爲dynamic
,併爲相應的key
分配了一個偵聽器。我應該如何在這方面做到這一點?
我的恐懼是我可能必須重做每個幀的整個頂點數組... – 2014-12-03 21:16:04