我有基本的UILabel,可以使用CACAKeyframeAnimation沿整个圆周设置动画:
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddArc(path,nil, center.x,center.y, radius , DEGREES_TO_RADIANS(from_degree), DEGREES_TO_RADIANS((360+from_degree)), NO);
CAKeyframeAnimation *theAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
theAnimation.path = path;
CGPathRelease(path);
// set the animation properties
theAnimation.duration = duration;
theAnimation.removedOnCompletion = NO;
theAnimation.fillMode = kCAFillModeBoth;
theAnimation.repeatCount = INFINITY;
theAnimation.calculationMode = kCAAnimationPaced;
[label.layer addAnimation:theAnimation forKey:@"position"];
有没有一种方法可以使圆弧的半径变化动画化,并将该变化传播到沿路径移动的标签上?
最佳答案
CGPathMoveToPoint(thePath, NULL, 100.f, 100.f);
CGPathAddLineToPoint(thePath, NULL, 200.f, 100.f);
CGPathAddArc(thePath, NULL, 100.f, 100.f, 100.f, 0.f, (360* M_PI)/180, NO);
CGPathCloseSubpath(thePath);
你可以用这个:)
关于ios - 使用核心动画对轨迹变化进行动画处理,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33074184/