0
目的のCloでUIViewに接続されているルートレイヤのサブレイヤーをアニメートしようとしています。私はここで利用可能な回答の数を試しているが、サブレイヤは固定されていて、その位置を全く変更していない。CALayerアニメーションをあるポイントから別のポイントに移動する
は、私はそれをアニメーション化するために、以下の方法を試してみました:
-(void)moveLayer:(CALayer*)layer to:(CGPoint)point with:(CGRect)bounds
{
CGMutablePathRef thePath = CGPathCreateMutable();
CGPathMoveToPoint(thePath,NULL,74.0,74.0);
CAKeyframeAnimation * theAnimation;
// Create the animation object, specifying the position property as the key path.
theAnimation=[CAKeyframeAnimation animationWithKeyPath:@"position"];
theAnimation.path=thePath;
theAnimation.duration=5.0;
// Add the animation to the layer.
[layer addAnimation:theAnimation forKey:@"position"];
}
そして、いずれかが、それは素晴らしいことだろう私を助けることができる場合も
`
[featureLayer setFrame:oldRect];
CGRect oldBounds = oldRect;
CGRect newBounds = faceRect;
CABasicAnimation* revealAnimation = [CABasicAnimation animationWithKeyPath:@"bounds"];
revealAnimation.fromValue = [NSValue valueWithCGRect:oldBounds];
revealAnimation.toValue = [NSValue valueWithCGRect:newBounds];
revealAnimation.duration = 3.0;
// Update the bounds so the layer doesn't snap back when the animation completes.
featureLayer.bounds = newBounds;
[featureLayer addAnimation:revealAnimation forKey:@"revealAnimation"];
[self.previewLayer setMask:featureLayer];
`
を使用します。前もって感謝します。
編集1
ただ、これはルート層の上にマスク画像で確認するために、私は他の1つの位置から移動するためにマスクをアニメーション化したいが、それはまだ滞在しています。