嗨,我是Iphone
开发新手。我正在创建一个可变速度的旋转图像动画。我如何获得变速但现在我想通过触摸保持来降低速度UIView
。我没有任何想法。那么,有人可以帮助我吗?我可以得到一些代码片段吗?
我在下面添加了一些代码片段
CABasicAnimation* rotationAnimation;
rotationAnimation =
[CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.fromValue = [NSNumber numberWithFloat: M_PI *2.0 * appDelegate.direction];
rotationAnimation.repeatCount = 1;
rotationAnimation.duration = interval;
rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
rotationAnimation.fillMode = kCAFillModeForwards;
rotationAnimation.removedOnCompletion = YES;
[imgv.layer addAnimation:rotationAnimation forKey:@"rotation"];
if(count<=repeatcount)
{
[self performSelector:@selector(funTime) withObject:nil afterDelay:interval];
isNotRotating = TRUE;
interval = interval + addTime;
addTime = addTime+0.001;
lblCount.text = [NSString stringWithFormat:@"%d",count];
count++;
NSLog(@"duration to rotate a single rotation %f",(interval+((repeat-1) *0.10)/repeat));
}
else
{
tap=0;
isNotRotating= TRUE;
[imgv.layer removeAllAnimations];
}
提前致谢