【发布时间】:2013-08-22 08:58:35
【问题描述】:
我有一个包含 CGPath 的 CAShapeLayer。使用 iOS 的内置动画,我可以使用动画轻松地将这条路径变形为另一条路径:
CABasicAnimation *morph = [CABasicAnimation animationWithKeyPath:@"path"];
morph.fromValue = (id)myLayer.path;
mayLayer.path = [self getNewPath];
morph.toValue = (id)myLayer.path;
morph.duration = 0.3;
[myLayer addAnimation:morph forKey:nil];
效果很好。
但是,我现在想在拖动操作期间在这些路径之间逐渐变形。为了做到这一点,我需要能够在拖动过程中的任何时候检索插值路径。有没有办法向 iOS 询问这个?
【问题讨论】:
-
在不平凡的情况下,内置的路径变形很快就会变得毫无用处。请参阅此处描述的问题和解释:stackoverflow.com/a/17864445/438982
-
确实如此,但就我而言,变形看起来不错...
标签: ios cocoa-touch core-graphics