path = CGPathCreateMutable();

    int udCount = 5;

    int width = self.frame.size.width / udCount ;

    int xOffset = 150;

    int yOffset = 200;

    int waveHeight = 50;

    CGPoint p1 = CGPointMake(width * -1 + xOffset, self.frame.origin.y + yOffset);

    CGPoint p2 = CGPointMake(width * 0 + xOffset, self.frame.origin.y + yOffset);

    CGPoint p3 = CGPointMake(width * 1 + xOffset, self.frame.origin.y + yOffset);

    CGPoint p4 = CGPointMake(width * 2 + xOffset, self.frame.origin.y + yOffset);

    CGPoint p5 = CGPointMake(width * 3 + xOffset, self.frame.origin.y + yOffset);

    CGPoint p6 = CGPointMake(width * 4 + xOffset, self.frame.origin.y + yOffset);

    CGPoint p7 = CGPointMake(width * 5 + xOffset, self.frame.origin.y + yOffset);

    CGPoint p8 = CGPointMake(width * 7 + xOffset, self.frame.origin.y + yOffset);

   

   

    CGPathMoveToPoint(path, NULL, p1.x,p1.y);

   

    //生成曲线路径

    CGPathAddQuadCurveToPoint(path, NULL, p1.x+width/2, p1.y - waveHeight, p2.x, p2.y);

    CGPathAddQuadCurveToPoint(path, NULL, p2.x+width/2, p2.y + waveHeight, p3.x, p3.y);

    CGPathAddQuadCurveToPoint(path, NULL, p3.x+width/2, p3.y - waveHeight, p4.x, p4.y);

    CGPathAddQuadCurveToPoint(path, NULL, p4.x+width/2, p4.y + waveHeight, p5.x, p5.y);

    CGPathAddQuadCurveToPoint(path, NULL, p5.x+width/2, p5.y - waveHeight, p6.x, p6.y);

    CGPathAddQuadCurveToPoint(path, NULL, p6.x+width/2, p6.y + waveHeight, p7.x, p7.y);

    CGPathAddQuadCurveToPoint(path, NULL, p7.x+width/2, p7.y - waveHeight, p8.x, p8.y);

 

創作者介紹
創作者 shadow 的頭像
shadow

資訊園

shadow 發表在 痞客邦 留言(0) 人氣()