开发者

How to draw line between two points with animation?

开发者 https://www.devze.com 2022-12-14 05:39 出处:网络
I have used th开发者_高级运维e code below for drawing a line between two points. #define PI 3.14159

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

精彩评论

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