2
나는이 CAKEyFrameAnimaton
을 작성하여 CALayer
을 X 축에 회전 시켰습니다. 그러나 그것은 회전하지 않습니다. 여기서 내가 뭘 잘못하고 있니?iOS CAKeyFrameAnimation 회전
CAKeyframeAnimation *topFoldAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.x"];
topFoldAnimation.duration = 15;
topFoldAnimation.repeatCount = 1;
topFoldAnimation.removedOnCompletion = NO;
topFoldAnimation.autoreverses = NO;
topFoldAnimation.fillMode = kCAFillModeForwards;
CATransform3D tTrans = CATransform3DIdentity;
tTrans.m34 = -1/900;
topFoldAnimation.values = [NSArray arrayWithObjects:
[NSValue valueWithCATransform3D:CATransform3DRotate(tTrans,DEGREES_TO_RADIANS(0),1,0,0)],
[NSValue valueWithCATransform3D:CATransform3DRotate(tTrans,DEGREES_TO_RADIANS(-30),1,0,0)],
[NSValue valueWithCATransform3D:CATransform3DRotate(tTrans,DEGREES_TO_RADIANS(-60),1,0,0)],
[NSValue valueWithCATransform3D:CATransform3DRotate(tTrans,DEGREES_TO_RADIANS(-90),1,0,0)],
nil];
topFoldAnimation.keyTimes = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:0.00],
[NSNumber numberWithFloat:0.25],
[NSNumber numberWithFloat:0.50],
[NSNumber numberWithFloat:1.00],
nil];
topFoldAnimation.timingFunctions = [NSArray arrayWithObjects:
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
nil];
[[backgroundAnimationLayer.sublayers objectAtIndex:1] addAnimation:topFoldAnimation forKey:@"transform.rotation.x"];
도움을 주시면 감사하겠습니다. 감사합니다 ...
예 m34를 할당하여 2.5D 원근법을 얻습니다. 왜 서브 레이어인가? 레이어에 적용하면 모든 하위 레이어가 변형됩니다. 맞습니까? –
맞아요, 저는 어떻게 든'm34'는'subLayerTransform'에 대해서만 영향을 미쳤다고 생각했습니다. 왜냐하면 저는 항상이 방법을 사용했기 때문에 그럴 것 같지 않습니다. 그래도 원하는 효과가없는 0을 효과적으로 할당 할 수 있습니다. – omz
cool. 내가 바꿔 볼게. –