Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

CGAffineTransformMakeRotation 360 degree rotation

I have a UIImageView that I am animating with the CGAffineTransformMakeRotation but I can't quite figure out how to get it to do a full 360 degree rotation. When I double 3.14 it no longer rotates because it's already there. How do I get past the first 180 degrees?

Any help, direction, links or code is much appreciated.

Thanks,
Sam

iMac 2.16 GHz Intel Core 2 Duo, Mac OS X (10.5.4)

Posted on Aug 23, 2008 3:59 PM

Reply
9 replies

Sep 19, 2008 6:17 AM in response to just.do.it

Hey thanks for the reply..Just gave it a try,and it didn't help. Here is my code:

CABasicAnimation *rotateAnimation = |CABasicAnimation animationWithKeyPath:@"transform"|;
rotateAnimation.duration = 1;
rotateAnimation.repeatCount = 1;
rotateAnimation.autoreverses = NO;
rotateAnimation.toValue = |NSValue valueWithCATransform3D:CATransform3DRotate(touchedLayer.transform, DegreesToRadians(180), 1.0 ,0.0 ,0.0)|;

CABasicAnimation *rotateBackAnimation = |CABasicAnimation animationWithKeyPath:@"transform2"|;
rotateBackAnimation.duration = 1;
rotateBackAnimation.repeatCount = 1;
rotateBackAnimation.autoreverses = NO;
rotateBackAnimation.toValue = |NSValue valueWithCATransform3D:CATransform3DRotate(touchedLayer.transform, DegreesToRadians(-180), 1.0 ,0.0 ,0.0)|;

|touchedLayer addAnimation:rotateAnimation forKey:@"rotate"|;
|touchedLayer addAnimation:rotateBackAnimation forKey:@"rotateback"|;

Any ideas?

Sep 19, 2008 7:33 AM in response to Arca

I tried that... I set rotateAnimation.repeatCount = 4; and the angle to 90 degrees..

Basically it just rotates my view 90 degrees 4 times from the same position. Meaning the transformation isn't combining, but rather it rotates 90 degrees resets back to 0 and does it again 3 more times.

Any idea how to "combine" transformations?

Thanks,
Felix

CGAffineTransformMakeRotation 360 degree rotation

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.