CAShapeLayerのパスの値を楕円から長方形に変更する明示的なアニメーションを作成すると、問題が発生します。
キャンバスコントローラーで、基本的なCAShapeLayerをセットアップし、ルートビューのレイヤーに追加します。
CAShapeLayer *aLayer;
aLayer = [CAShapeLayer layer];
aLayer.frame = CGRectMake(100, 100, 100, 100);
aLayer.path = CGPathCreateWithEllipseInRect(aLayer.frame, nil);
aLayer.lineWidth = 10.0f;
aLayer.strokeColor = [UIColor blackColor].CGColor;
aLayer.fillColor = [UIColor clearColor].CGColor;
[self.view.layer addSublayer:aLayer];
次に、パスをアニメーション化すると、アニメーションの最後の数フレームでシェイプが長方形になり、最初の数フレームで図形が長方形から離れてアニメーション化すると、奇妙なグリッチ/ちらつきが発生します。アニメーションは次のように設定されています。
CGPathRef newPath = CGPathCreateWithRect(aLayer.frame, nil);
[CATransaction lock];
[CATransaction begin];
[CATransaction setAnimationDuration:5.0f];
CABasicAnimation *ba = [CABasicAnimation animationWithKeyPath:@"path"];
ba.autoreverses = YES;
ba.fillMode = kCAFillModeForwards;
ba.repeatCount = HUGE_VALF;
ba.fromValue = (id)aLayer.path;
ba.toValue = (__bridge id)newPath;
[aLayer addAnimation:ba forKey:@"animatePath"];
[CATransaction commit];
[CATransaction unlock];
CATransactionのロック/ロック解除、さまざまな塗りつぶしモードでの再生など、さまざまなことを試しました...
グリッチの画像は次のとおりです: http ://www.postfl.com/outgoing/renderingglitch.png
私が経験していることのビデオはここで見つけることができます:http: //vimeo.com/37720876