开发者

How to draw line between two points with animation?

I have used th开发者_高级运维e code below for drawing a line between two points.

#define PI 3.14159

CGContextBeginPath(ctx);

int x;
for(int y=rect.origin.y; y < rect.size.height; y++)
{
    x = ((rect.size.width/4) * sin(((y*4) % 360) * PI/180)) + rect.size.width/2;

    if(y == 0)
    {
        CGContextMoveToPoint(ctx, x, y);
    }
    else
    {
        CGContextAddLineToPoint(ctx, x, y);
    }
}

CGContextStrokePath(ctx);

But I want to implement this with animation. How would it be possible? Can you help me?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜