Take the 2-minute tour ×

I have a formula for setting x and y of an object at every frame. In a classic for (i=0; i < x; i++) loop, I can bind it to the i value and calculate x and y values based on the current value of i that represents the passing of time.

I intended to use it with a NSTimer object and update the coordinate points at every tick, but I've seen that NSTimer is descouraged for animations.

Can I do the same with Core Animation? Instead of the standard "from here to there in given seconds", I would need a method to "update the position with this formula".

share|improve this question
Good question..I would like to know too.. –  Krishnabhadra May 6 '11 at 6:55
I haven't used it myself, and hopefully someone can give you more details, but CAKeyframeAnimation is probably what you want. –  Josh Caswell May 6 '11 at 7:04
add comment

1 Answer

up vote 3 down vote accepted

If you can model your function with a cubic Bézier curve, you can create a custom CAMediaTimingFunction instance and assign it to the animation's timingFunction property.

If a Bézier curve does not work, a CAKeyframeAnimation might indeed work.

share|improve this answer
add comment

Your Answer


