I'm currently developing a game using Swift 3 and SpriteKit. I have a coin that falls during a game that the user can collect. Right now, it falls and doesn't have any rotation or anything. I want to add a 3D spinning effect while it falls. This effect should be a rotation around the y-axis . I'm not sure how to create a 3D effect like this or if I should be using another program.
I've found what I'm looking for on another stack overflow post but it's in objective-c:
I've found a way to do this (from the link) with Core Animations/ Core Graphics, but I don't know how to make it work on an SKSpriteNode.
var coinFlip = CATransition()
coinFlip.startProgress = 0
coinFlip.endProgress = 1.0
coinFlip.type = "flip"
coinFlip.subtype = "fromRight"
coinFlip.duration = 0.5
coinFlip.repeatCount = 2
yourView.layer.addAnimation(coinFlip, forKey: "transition")
This last line only works on UIViews and therefore causes errors when I try to run it on an SKSpriteNode.
If someone could explain to me how to do this and/or show me another way of creating this animation for an SKSpriteNode it would be greatly appreciated.