0

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

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
Sam
  • 1,130
  • 12
  • 36
  • You should use Sprite Kit actions, not UIView animations which, if at all, would operate on the entire SKView – CodeSmile Aug 29 '14 at 10:26
  • Thank you. I looked them up and used them. If you could just post it in an answer so I can mark it as the best one, and write my solution. – Sam Aug 29 '14 at 10:35

0 Answers0