Created
January 20, 2013 23:33
-
-
Save C4Code/4582578 to your computer and use it in GitHub Desktop.
Basic example of how to create a CGPath to use for a visible object's shadowPath property
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 | |
// test | |
// | |
// Created by moi on 13-01-20. | |
// Copyright (c) 2013 moi. All rights reserved. | |
// | |
#import "C4WorkSpace.h" | |
@implementation C4WorkSpace { | |
C4Shape *s; | |
} | |
-(void)setup { | |
CGFloat width = 100, height = 100; | |
s = [C4Shape ellipse:CGRectMake(0, 0, width, height)]; | |
[self.canvas addShape:s]; | |
CGMutablePathRef newShadowPath = CGPathCreateMutable(); | |
CGPathMoveToPoint(newShadowPath, nil, 0, 0); | |
CGPathAddLineToPoint(newShadowPath, nil, width, 0); | |
CGPathAddLineToPoint(newShadowPath, nil, width, height); | |
CGPathAddLineToPoint(newShadowPath, nil, 0, height); | |
CGPathAddLineToPoint(newShadowPath, nil, 0, 0); | |
s.animationDuration = 1.0f; | |
s.shadowOffset = CGSizeMake(width/2,height/2); | |
s.shadowOpacity = 0.8; | |
s.shadowPath = newShadowPath; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment