views:

298

answers:

0

Hello Animators!

The scenario: The user has touched and moved an image to a certain position, he/she then release the object. It should now in a realistic way fall to the bottom of the screen, see this video for some inspiration.

The touching and dragging parts are already implemented using:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;

I was thinking of hooking up the animation code inside:

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;

My object is a UIView containing an UIImage and I'm using SDK 3.1.

My ideas:

  • Create a path using: CGPathRef and CGPathAddCurveToPoint. This will resemble one iteration of the falling object. See this ugly picture I have drawn for an example: alt text
  • By calculating the distance form the object to the bottom I will know how may of these animated iterations I will need.

Questions:

  • Is this the right way to go? With the path and looping over the animation.
  • How do I add acceleration to the path it is traveling? I would like it to slow down before it switches direction and then speed up again.
  • Will the other parts of the GUI be responsive to user interaction during the animation sequence?


As you noticed I am fairly new to CoreAnimation and I draw really ugly. :) Any pointer in the right direction will be highly appreciated.

Best regards

ABeanSits