Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy are my animation values ignored?
    text
    copied!<p>I try to do a CAKeyFrameAnimation for rotating an layer:</p> <pre><code>CALayer* theLayer = myView.layer; CAKeyframeAnimation* animation; animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"]; animation.duration = 1.0; animation.cumulative = NO; animation.repeatCount = 1; animation.removedOnCompletion = NO; animation.fillMode = kCAFillModeForwards; 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], // ignored! [NSNumber numberWithFloat:0.7 * M_PI], nil]; // ignored! animation.keyTimes = [NSArray arrayWithObjects: [NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:0.2], [NSNumber numberWithFloat:2.0], // ignored! [NSNumber numberWithFloat:1.5], // ignored! [NSNumber numberWithFloat:2], nil]; // ignored! animation.timingFunctions = [NSArray arrayWithObjects: [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], nil]; [theLayer addAnimation:animation forKey:@"transform.rotation.z"]; </code></pre> <p>Like you can see in the comments, the animation only runs two of the key frames, but not all of them. No matter what kind of values I put in there, the animation will never run more than two key frames.</p> <p>What could be wrong there?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload