Created
May 12, 2012 16:43
-
-
Save C4Code/2667555 to your computer and use it in GitHub Desktop.
how to rotate shapes using the shape.transform property (uses CGAffineTransform)
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 | |
// rotate | |
// | |
// Created by Travis Kirton on 12-04-04. | |
// Copyright (c) 2012 POSTFL. All rights reserved. | |
// | |
#import "C4WorkSpace.h" | |
C4Shape *s1, *s2; | |
@implementation C4WorkSpace | |
-(void)setup { | |
s1 = [C4Shape rect:CGRectMake(200, 200, 100, 100)]; | |
[self.canvas addShape:s1]; | |
s2 = [C4Shape rect:CGRectMake(500, 200, 100, 100)]; | |
s2.layer.anchorPoint = CGPointMake(0, 2); | |
[self.canvas addShape:s2]; | |
} | |
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | |
s1.animationDuration = 1.0f; | |
s1.animationOptions = AUTOREVERSE | REPEAT; | |
s1.transform = CGAffineTransformMakeRotation(PI); | |
s2.animationDuration = 1.0f; | |
s2.animationOptions = AUTOREVERSE | REPEAT; | |
s2.transform = CGAffineTransformMakeRotation(PI); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment