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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to