Looping CAKeyframeAnimation stop in place?
Looping CAKeyframeAnimation stop in place?
- Subject: Looping CAKeyframeAnimation stop in place?
- From: "Eric E. Dolecki" <email@hidden>
- Date: Fri, 09 Nov 2012 14:53:57 -0500
I have a UIImageView that I spin forever (think a top-down view of a spool
in a tape cassette). However I would like to stop the rotation animation &
when it does NOT reset the UIImageView to it's original starting position.
I have this to start it:
CAKeyframeAnimation *rotationAnimation;
rotationAnimation = [CAKeyframeAnimation animationWithKeyPath:@
"transform.rotation.z"];
rotationAnimation.values = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:0.0 * M_PI],
[NSNumber numberWithFloat:0.75 * M_PI],
[NSNumber numberWithFloat:1.5 * M_PI],
[NSNumber numberWithFloat:2.0 * M_PI], nil];
rotationAnimation.calculationMode = kCAAnimationPaced;
rotationAnimation.removedOnCompletion = NO;
rotationAnimation.fillMode = kCAFillModeForwards;
rotationAnimation.timingFunction = [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionLinear];
rotationAnimation.duration = 5.0;
rotationAnimation.repeatCount = INFINITY;
CALayer *layer = [leftSpool layer];
[layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
And this to stop it:
//This is resetting the rotation to 0 - a visible jump
[leftSpool.layer removeAnimationForKey:@"rotationAnimation"];
I am looking for a way to start it, stop at current angle, and then restart
at current angle...
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden