私はCALayer
のシャドウパスにアニメートしています。CALayerのシャドウパスをアニメートする
フレームのサイズは正しく変更されますが、影の縮尺は変更されません。
代わりに影が最終的なサイズCGSize(20,20)
で開始し、Iが初期値まず
[CATransaction begin];
[CATransaction setAnimationDuration: 0];
[CATransaction setDisableActions: TRUE];
layer.frame = CGRectMake(0,0,10,10);
layer.shadowPath = [UIBezierPath bezierPathWithRect:layer.bounds].CGPath;
[CATransaction commit];
[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:10] forKey:kCATransactionAnimationDuration];
layer.frame = CGRectMake(0,0,20,20);
layer.shadowPath = [UIBezierPath bezierPathWithRect:tile.bounds].CGPath;
[CATransaction commit];
努力のおかげで私の解決策がなぜ機能しないのか教えていただけますか?なぜあなたはフレームをアニメーションできますが、シャドウパスはアニメーションできませんか? – prostock
シャドウアニメーションのポイントは 'animationWithKeyPath'を' @ "shadowPath"に設定することです。つまり、アニメーションの対象は 'shadowPath'です。私はこのメカニズムも知らなかったが、 'animationWithKeyPath'の設定はアニメーションを作る上で非常に重要です。これでいい ? – weed