Animation - Stopping image at 'pos' position

Discussion in 'iOS Programming' started by Moon013, Sep 3, 2008.

  1. Moon013 macrumors newbie

    Jul 14, 2008
    i uses core animation. I uses this to make it animate from a place to the other:

    CABasicAnimation *animation;

    animation = [CABasicAnimation animationWithKeyPath:mad:"position"];

    animation.duration = duration;
    animation.repeatCount = 1;
    animation.fromValue = [NSValue valueWithCGPoint:from];
    animation.toValue = [NSValue valueWithCGPoint:to];

    what I want to do is when i touch an image while its animating, the image will stop at the center, and animation stops.

    The problems faced are:
    - How do I touch an image while its animation? the image x, y position does not change while its animating? it is based on what you put it when you alloc the image?

    - how do i make it stop and put it at the center? Using transfrom to transform the image from its original position to the center of the screen?

    Any help appreciated. Kind of noob here.


Share This Page