Reputation: 339
I have a SKSpriteNode I use like a button. When I tap on it, it calls a function that moves the camera in a SCNScene
SCNTransaction.begin()
SCNTransaction.setAnimationDuration(2)
SCNTransaction.setCompletionBlock {
SCNTransaction.begin()
SCNTransaction.setAnimationDuration(2)
self.ResetCameraButton.texture = self.FunctionAtlas.textureNamed("ResetCameraSelected")
self.cameraOrbit.eulerAngles.y = initialAngleY
self.cameraOrbit.eulerAngles.x = initialAngleX
self.cameraNode.camera?.orthographicScale = self.initialPinchScale
SCNTransaction.commit()
}
SCNTransaction.commit()
This is the button: and this is the tapped button:
I would like to put the second image, as texture of my SKSpriteNode, during the animation and the first one, only when the animation ends.
If I add below:
self.ResetCameraButton.texture = self.FunctionAtlas.textureNamed("ResetCameraUnselected")
to set the Unselected texture, it doesn't work!
How can I get the end of the animation to set the 'unselected' texture to my SKSpriteNode?
Upvotes: 0
Views: 760
Reputation: 13462
SKNode
s are part of SpriteKit which does not understand SCNTransaction
. Only SceneKit APIs marked as "animatable" in the documentation can benefit from this feature.
Upvotes: 1