首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >镜像翻转CGPath

镜像翻转CGPath
EN

Stack Overflow用户
提问于 2011-09-09 17:04:50
回答 1查看 2.5K关注 0票数 1

我有一个简单的圆形CGPath。我在水平翻转它时遇到了困难,就像一面镜子的效果。

如果你正在回答这个问题,请尝试提供完整的代码,而不仅仅是一个通用的参考……

thx

EN

回答 1

Stack Overflow用户

发布于 2011-09-10 00:44:10

代码语言:javascript
复制
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];
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7359359

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档