Skip to content

Instantly share code, notes, and snippets.

@travisjeffery
Created February 5, 2013 16:37
Show Gist options
  • Save travisjeffery/4715669 to your computer and use it in GitHub Desktop.
Save travisjeffery/4715669 to your computer and use it in GitHub Desktop.
[[UIColor colorWithRed:0 green:192/255.0 blue:255/255.0 alpha:1] set];
CGContextSetLineWidth(context, 1);
CGContextSetLineJoin(context, kCGLineJoinRound);
const CGFloat amplitude = halfHeight / 4;
for(CGFloat x = 0; x < width; x += 0.5)
{
CGFloat y = amplitude * sinf(2 * M_PI * (x / width) * frequency) + halfHeight;
if(x == 0)
CGContextMoveToPoint(context, x, y);
else
CGContextAddLineToPoint(context, x, y);
}
CGContextStrokePath(context);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment