A seemingly simple task: rotate an image about the y-axis.
The problem: only half the image will rotate.
(Note: The z-axis works fine. It's the y-axis and x-axis where there is some issue about rotating in 3D space that is causing issues.)
I was trying to avoid Core Graphics, because I'm fairly new to OpenGL.
Code:
CABasicAnimation *rotateAnimation = [CABasicAnimation animation];
rotateAnimation.keyPath = @"transform.rotation.z";
rotateAnimation.fromValue = [NSNumber numberWithFloat:DegreesToRadians(0)];
rotateAnimation.toValue = [NSNumber numberWithFloat:DegreesToRadians(360)];
rotateAnimation.duration = 10;
rotateAnimation.removedOnCompletion = NO;
// leaves presentation layer in final state; preventing snap-back to original state
rotateAnimation.fillMode = kCAFillModeForwards;
rotateAnimation.repeatCount = 99;
rotateAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
// add the animation to the selection layer. This causes it to begin animating
[imageView.layer addAnimation:rotateAnimation forKey:@"rotateAnimation"];