Animating a Rotating Image

Discussion in 'iOS Development' started by maulik_adhia, Feb 9, 2009.

  1. maulik_adhia

    maulik_adhia New Member

    Joined:
    Feb 9, 2009
    Messages:
    3
    Likes Received:
    0
    Is there any way to animate the rotating image?
    There is a wheel like image which I am rotating on touch. The rotation is done using a timer. What I want is if i could make the rotation look more realistic. The wheel rotates for a few seconds and then stops suddenly but I wanted it to stop slowly which makes it look more realistic. So is there any way by which we can slow down the rotation movement at the end when it is going to stop.
    ------------------double post merged------------------
    Guys please reply to do this. I hope somebody knows the answer to this.

    If you have not understood the question then please ask.
    But please atleast give some reply to do this.
  2. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    In your animation block, set the animation delegate to self (usually) and the animationDidStop selector to whatever. Also, create a variable to use as the animation time.

    In the animation did stop selector, increase the variable used for the animation time and recall the method with the animation. The illusion will be that the wheel is slowing down.

    For realism, change the variable for the amount to spin also. Decrease that with pass through the animationDidStop selector, when you increase the animation speed variable. When the amount to spin gets below a certain threshold, pass a return statement before the recall to the method with the animation. The wheel should now be stopped, after slowing.
  3. maulik_adhia

    maulik_adhia New Member

    Joined:
    Feb 9, 2009
    Messages:
    3
    Likes Received:
    0
    My code

    This is the my code snippet and the xib within it. You have to put a circular image in the xib and connect the image view to the xib.
  4. maulik_adhia

    maulik_adhia New Member

    Joined:
    Feb 9, 2009
    Messages:
    3
    Likes Received:
    0
    This is code file

    Thank you.

    Attached Files:

Share This Page