Kasper Hansen Kasper Hansen - 1 year ago 125
Swift Question

SpriteKit + Swift - How do I move a node with easing?

I'm creating a game in SpriteKit using Swift.
I have a node on the scene and when the user touches the screen, I want the node to move up with easeOut. When the user releases the screen the node should fall to the ground.
I'm looking for a SKAction which can move a node with easeOut.
Can anyone help me making that action?

Thanks in advance!

Answer Source

If you really want to achieve this through SKActions triggering movement you are after the timingMode property of SKAction.

someAction.timingMode = .EaseInEaseOut

As Özgür is writing in the comment though this can also be achieved with physics, which might be better, depending on your requirement.