我使用CoreAnimation处理卡片翻转动画。我想要动画的图层是UIView,UIImageViews作为子视图。动画方法:
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"];
问题在于图层的锚点似乎是错误的,因为它在x = 0处为视图设置动画。但是图层的锚点具有值(0.5,0.5)
有什么建议吗?