Curve animation

Discussion in 'iOS Programming' started by blackmesa, Apr 6, 2009.

  1. blackmesa macrumors newbie

    Mar 30, 2009
    Is it possible to move an image in animation ([UIView beginAnimation] block) on a curve?

    Let's say I have an image located at x1,y1. I want that image to move to x2,y2 following the equation:
  2. Taum macrumors member

    Jul 28, 2008
    I'm pretty positive it could be done by creating a CABasicAnimation and tweaking either the valueFunction (from the CAPropertyAnimation superclass) or the timingFunction (from the CAAnimation superclass).

    However I think you would have to make your equation a function of the time, but that is probably just basic math that I'm too busy/lazy to think about at the moment ;)
  3. CarlosH macrumors member

    Apr 9, 2008
    San Francisco, CA
    You can do it by creating a CGMutablePathRef, and assigning it to your CAKeyframeAnimation instance.
  4. blackmesa thread starter macrumors newbie

    Mar 30, 2009

Share This Page