Created
May 16, 2013 03:26
-
-
Save C4Code/5589162 to your computer and use it in GitHub Desktop.
Shape to shape transitions, 4Les
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 | |
// Examples | |
// | |
// Created by Travis Kirton on 12-07-23. | |
// | |
#import "C4WorkSpace.h" | |
@implementation C4WorkSpace { | |
C4Shape *circle, *square; | |
C4View *shapeView; | |
BOOL isCircle; | |
} | |
-(void)setup { | |
CGRect frame = CGRectMake(0, 0, 386,386); | |
shapeView = [[C4View alloc] initWithFrame:frame]; | |
circle = [C4Shape ellipse:frame]; | |
square = [C4Shape rect:frame]; | |
[shapeView addShape:circle]; | |
[self.canvas addSubview:shapeView]; | |
shapeView.center = self.canvas.center; | |
isCircle = YES; | |
} | |
-(void)touchesBegan { | |
if(isCircle) { | |
[UIView transitionFromView:circle | |
toView:square | |
duration:1.0 | |
options:UIViewAnimationOptionTransitionFlipFromLeft | |
completion:nil]; | |
isCircle = NO; | |
} else { | |
[UIView transitionFromView:square | |
toView:circle | |
duration:1.0 | |
options:UIViewAnimationOptionTransitionFlipFromRight | |
completion:nil]; | |
isCircle = YES; | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment