Skip to content

Instantly share code, notes, and snippets.

@wizard1066
Created August 18, 2022 09:57
Show Gist options
  • Save wizard1066/c2b4b839f0bd8e61a94294d31d137647 to your computer and use it in GitHub Desktop.
Save wizard1066/c2b4b839f0bd8e61a94294d31d137647 to your computer and use it in GitHub Desktop.
if refresh {
morpher.targets = [cubeGeometry2,cubeGeometry]
cubeNode.morpher = morpher
SCNTransaction.begin()
SCNTransaction.animationDuration = 4.0
cubeNode.morpher?.setWeight(1.0, forTargetAt: 0)
SCNTransaction.completionBlock = {
newNode = SCNNode(geometry: cubeGeometry2)
cubeNode.removeFromParentNode()
coreNode.addChildNode(newNode)
}
SCNTransaction.commit()
} else {
morpher.targets = [cubeGeometry]
newNode.morpher = morpher
SCNTransaction.begin()
SCNTransaction.animationDuration = 4.0
newNode.morpher?.setWeight(1.0, forTargetAt: 0)
SCNTransaction.completionBlock = {
cubeNode = SCNNode(geometry: cubeGeometry)
newNode.removeFromParentNode()
coreNode.addChildNode(cubeNode)
}
SCNTransaction.commit()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment