Thursday, 28 June 2012

shake gesture coding

[UIView beginAnimations:@"RotationAnimation" context:nil];
               
                CABasicAnimation *fullRotationAnimation;
                fullRotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
                fullRotationAnimation .fromValue = DegreesToNumber(-0.9);
                fullRotationAnimation.toValue = DegreesToNumber(0.9);
                fullRotationAnimation.duration = 0.25;          // speed for the rotation. Smaller number is faster
                fullRotationAnimation.repeatCount = 1e100f;  // number of times to spin. 1 = once
                [fullRotationAnimation setFillMode:kCAFillModeBoth];
                [gestureView.layer addAnimation:fullRotationAnimation forKey:@"rotate"];
               
                [UIView commitAnimations];

No comments:

Post a Comment