Question

I have a problem with the image rotated.

The serrated(shake) image will be shown when rotating the image if i use CATransform3DMakeRotation(M_PI, 0, 0, -1.0) to make a animation with layer.

The backgroundView is added into another animation view (same as the backgroundView, but the direction is reverse).

The code is:

CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI , 0, 0, -1.0)];
animation.duration = 30;
animation.cumulative = YES;
animation.repeatCount = INT_MAX;
[backgroundView.layer addAnimation:animation forKey:@"animationOne"];

Thank you for your time.

Was it helpful?

Solution

The problem is fixed , to use the function can remove the serrate of image when rotating.

[self.layer setShouldRasterize:YES];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top