2

これは、 X軸を中心CAKEyFrameAnimatonに回転するように作成しました。CALayerしかし、それは回転していません。私はここで何が間違っているのですか?

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"];

どんな助けでも大歓迎です。ありがとう...

4

1 に答える 1

1

あなたのアニメーションkeyPathは間違っています、それは正しいはずであり、そうではtransformありませんtransform.rotation.x

また、整数除算を使用しているため、0で終わることになります。tTrans.m34おそらくそうあるべき-1.0/900です。

于 2011-08-29T06:17:56.940 に答える