我有一个简单的圆形 CGPath。我无法水平翻转它,就像镜面效果一样。
如果您正在回答这个问题,请尝试提供完整的代码,而不仅仅是一般参考...
谢谢
我有一个简单的圆形 CGPath。我无法水平翻转它,就像镜面效果一样。
如果您正在回答这个问题,请尝试提供完整的代码,而不仅仅是一般参考...
谢谢
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];