Skip to content

Instantly share code, notes, and snippets.

@drart
Created June 2, 2013 10:53
Show Gist options
  • Save drart/5693291 to your computer and use it in GitHub Desktop.
Save drart/5693291 to your computer and use it in GitHub Desktop.
Every new touch creates a new object that animates across the screen.
//
// 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