开发者

Animating changing values of CGContextFillRect

Is it possible to smoothly animate a changed width property of CGContextFillRect over say 5 seconds?

CGContextFillRect(context, CGRectMake(x, y, width, height));

I'm trying to write a method for an iphone app that basically takes a time value and animates the change of CGContextFillRect width from the initial value to the final value smoothly. I need steering in the right direction of research.

If not CGContextFillRect then perhaps there is some other开发者_开发百科 rectangle could be animated like a CALayer? hmmm


A CALayer can be animated trivially in this way. If you want a smooth animation of the CGFillRect you'd have to use a timer or a CADisplayLink or some other timed system.

To do this with a CALayer look into CABasicAnimation, you can tell it to do a cumulative animation, repeated however many times you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜