Skip to content

Instantly share code, notes, and snippets.

@C4Code
Created October 1, 2012 16:11
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/3812756 to your computer and use it in GitHub Desktop.
Save C4Code/3812756 to your computer and use it in GitHub Desktop.
Rotating an object with a PAN gesture
//
// 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