Core Animation formula for movement

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".


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.

链接地址: http://www.djcxy.com/p/6712.html

上一篇: 使用OpenCV工具检测国际象棋从连续的图像差异中移动

下一篇: Core Animation运动公式