Last active
December 16, 2015 06:19
-
-
Save C4Tutorials/5390758 to your computer and use it in GitHub Desktop.
Polygon Spiral
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// C4WorkSpace.m | |
// Complex Shapes Tutorial | |
// | |
// Created by Travis Kirton. | |
// | |
#import "C4WorkSpace.h" | |
@implementation C4WorkSpace | |
-(void)setup { | |
CGPoint polyPts[64]; | |
for(int i = 0; i < 64; i++) { | |
polyPts[i] = CGPointMake(4*i*[C4Math sin:TWO_PI/16*i], 4*i*[C4Math cos:TWO_PI/16*i]); | |
polyPts[i].x += self.canvas.center.x; | |
polyPts[i].y += self.canvas.center.y; | |
} | |
C4Shape *spiral = [C4Shape polygon:polyPts pointCount:64]; | |
[self.canvas addShape:spiral]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment