I'm rotating a ball based on pan gestures, and I want to add inertia. To do this, I decided to use animateWithDuration when pan gesture finished. The problem is that instead of animating, the position of the ball changes straight away. I'll be posting the code bellow.
func moveByInertia(finalPosition: CGPoint, finalRotation: CGFloat)
{
UIView.animateWithDuration(2, animations:
{
self.tommy.position = finalPosition
self.tommy.zRotation = finalRotation
})
}
The arguments are definitely passed correctly into this function because it moves to the correct position. The problem is that it does so without animating. I couldn't find the same problem with a solution on the internet.
Thanks in advance