Skip to content

Instantly share code, notes, and snippets.

@C4Code
Created May 16, 2013 03:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save C4Code/5589162 to your computer and use it in GitHub Desktop.
Save C4Code/5589162 to your computer and use it in GitHub Desktop.
Shape to shape transitions, 4Les
//
// 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