CALayer transformation - anchorPoint problem
I work on a card flip animation with CoreAnimation. The layer I want to animation开发者_如何转开发 is a UIView with UIImageViews as subviews. The animation approach:
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.duration=2.0f;
animation.repeatCount=1;
animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(0.0, 0, 1, 0)];
animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI, 0, 1, 0)];
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;
[layer addAnimation:animation forKey:@"flip"];
The problem is that the anchor point of the layer seems to wrong because it animates the view at the point x = 0. But the anchor point of the layer has the value (0.5, 0.5)
Any suggestions?
精彩评论