Created
June 2, 2013 10:53
-
-
Save drart/5693291 to your computer and use it in GitHub Desktop.
Every new touch creates a new object that animates across the screen.
This file contains 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 | |
// Touch2Animation | |
// | |
// Created by Adam Tindale on 2013-06-01. | |
// | |
#import "C4WorkSpace.h" | |
@implementation C4WorkSpace | |
-(void)setup{} | |
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
C4Shape * an = [C4Shape rect:CGRectMake(-40, 10, 30, 30)]; | |
[an setCenter:CGPointMake(-40, 30)]; | |
[self.canvas addShape:an]; | |
an.animationDuration = 1.0f; | |
[an setCenter:CGPointMake(self.canvas.width + 40, 30)]; | |
[an runMethod:@"removeFromSuperview" afterDelay:an.animationDuration+.01f]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment