Reputation: 152
I'm trying to make an iPhone/iPad app, and I am currently trying to have an image spin slowly 360 degrees. But when I increase the animation duration, the picture rotates 1/4 of the way and then resets back to the beginning of the animation.
Can anyone tell me what is wrong with this?
What I have so far:
CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
[fullRotation setFromValue:[NSNumber numberWithFloat:0]];
[fullRotation setToValue:[NSNumber numberWithFloat:((2*M_PI))]];
fullRotation.speed = .5f;
fullRotation.duration = 5.5;
fullRotation.repeatCount = 1;
fullRotation.repeatCount = HUGE_VALF;
[[cosmic layer] addAnimation:fullRotation forKey:@"transform.rotation"];
Upvotes: 0
Views: 570
Reputation: 1531
Just delete this one line from your code:
fullRotation.speed = .5f;
and then adjust duration you want.
Upvotes: 1