我有一个简单的圆形CGPath。我在水平翻转它时遇到了困难,就像一面镜子的效果。
如果你正在回答这个问题,请尝试提供完整的代码,而不仅仅是一个通用的参考……
thx
发布于 2011-09-10 00:44:10
UIBezierPath* aPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake( 0, -240, 240, 240 )];
// This will mirror the path
CGAffineTransform rotation = CGAffineTransformMakeScale(1.0, -1.0);
CGMutablePathRef f = CGPathCreateMutable();
CGPathAddPath(f, &rotation, aPath.CGPath);
CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
pathAnimation.calculationMode = kCAAnimationPaced;
pathAnimation.fillMode = kCAFillModeRemoved;
pathAnimation.rotationMode = kCAAnimationRotateAutoReverse;
pathAnimation.removedOnCompletion = NO;
pathAnimation.path = f;
pathAnimation.repeatCount = HUGE_VALF;;
pathAnimation.duration = 5.0f;
[r2.layer addAnimation:pathAnimation forKey:nil];https://stackoverflow.com/questions/7359359
复制相似问题