Created
October 1, 2012 16:11
-
-
Save C4Code/3812756 to your computer and use it in GitHub Desktop.
Rotating an object with a PAN gesture
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 | |
// rotatingInteraction | |
// | |
// Created by moi on 12-09-30. | |
// Copyright (c) 2012 moi. All rights reserved. | |
// | |
#import "C4WorkSpace.h" | |
@implementation C4WorkSpace { | |
C4Image *img; | |
} | |
-(void)setup { | |
img = [C4Image imageNamed:@"C4Sky.png"]; | |
img.width = 200; | |
img.center = self.canvas.center; | |
img.perspectiveDistance = 200.0f; | |
[img addGesture:PAN name:@"pan" action:@"move:"]; | |
[self.canvas addImage:img]; | |
[self runMethod:@"beginAnimation" afterDelay:0.1]; | |
} | |
-(void)beginAnimation { | |
img.animationDuration = 4.0f; | |
img.animationOptions = REPEAT | LINEAR; | |
img.rotationX = TWO_PI; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment