iphone - Why are my animation values ignored? -
I try to do a CAKeyFrameAnimation for rotating a layer: As you can see in the comments, the animation only has two key frames but none of them runs. No matter what kind of values I have put in there. Animation will never run more than two key frames What could be wrong?
CALayer * theLayer = MyView .layer; CAKeyframeAnimation * Animation; Animation = [CAKeyframeAnimationwith animation: @ "transform.rotation.z"]; Animation.duration = 1.0; Animation cubicle = num; Animation. RepeatCount = 1; Animation. RemovedOnCompletion = No; Animation.philmedia = kCFilModford; Animation.values = [NSArray arrayWithObjects: [NSNumber numberWithFloat: 0.0 * M_PI], [NSNumber numberWithFloat: 0.5 * M_PI], [NSNumber numberWithFloat: 0.3 * M_PI], // animation stops here ... [NSNumber NumberWithFloat: 0.8 * M_PI], // Defy! [NSNumber numberWithFloat: 0.7 * M_PI], zero]; // Ignored! Animation.keyTimes = [NSArray arrayWithObjects: [NSNumber numberWithFloat: 0.0], [NSNumber numberWithFloat: 0.2], [NSNumber numberWithFloat: 2.0], // ignored! [Float with NSNumber Number: 1.5], // Ignore! [NSNumber Number blast: 2], zero]; // Ignored! animation.timingFunctions = [NSArray arrayWithObjects: [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionLinear], [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionLinear], [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionLinear], [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionLinear], [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionLinear], nil]; [TheLayer addAnimation: animation fork: @ "transform.rotation.z"];
Is it possible that you set the animation up to 1 and still your key time 0 , 0.2 and then there are 2 ... which means that the animation will stop before you reach the third value.
Comments
Post a Comment