Question

Im having trouble animating a wheel using touch. Ive spent some time punching in different numbers values for duration, spin times and animation durations to get a smooth move using on thouchsMove, but every time a touch happens the wheel rotates and what seems to be happening is it jumps back to its original position. If any one can shed some light on this i would very much appreciate it.

CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.fillMode = kCAFillModeForwards;
rotationAnimation.removedOnCompletion = NO;
rotationAnimation.delegate = self; 

rotationAnimation.toValue = [NSNumber numberWithFloat: 2  * 1 * 45 ];
rotationAnimation.duration = 2;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = 1; 


rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];


[animatedImage.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top