关于旋转动画只能画少一个pai 的问题
2014-10-10 17:01
302 查看
转载自:http://blog.csdn.net/zhibudefeng/article/details/8691567
CABasicAnimation *rotationAnimation = [CABasicAnimationanimationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumbernumberWithFloat:2*M_PI*0.722];
rotationAnimation.duration =
1.0f;
rotationAnimation.repeatCount =
MAXFLOAT;
rotationAnimation.autoreverses =
YES;
rotationAnimation.timingFunction = [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[self.pointerImageView.layeraddAnimation:rotationAnimation
forKey:nil];
用下面这种方法则只会花半个圆:
CGAffineTransform transform;
transform = CGAffineTransformRotate(self.pointerImageView.transform,2*M_PI*0.722);
[UIView beginAnimations:@"rotate" context:nil ];
[UIViewsetAnimationDuration:2];
[UIViewsetAnimationDelegate:self];
[self.pointerImageView setTransform:transform];
[UIView commitAnimations];
如果想动画执行一次后停止在当前位置 ,则应该这么做:
CABasicAnimation *rotationAnimation = [CABasicAnimation
animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber
numberWithFloat:2*M_PI*0.722];
rotationAnimation.duration =
1.5f;
rotationAnimation.repeatCount =
0;
rotationAnimation.autoreverses =
NO;
rotationAnimation.removedOnCompletion =
NO; //要实现完成动画后停止在当前位置
这个值应该设置成NO 然后下边的kCAFillModeForwards这个才会起作用
rotationAnimation.fillMode =
kCAFillModeForwards;
rotationAnimation.delegate =
self;
rotationAnimation.timingFunction = [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[self.pointerImageView.layer
addAnimation:rotationAnimation forKey:@"KeyStartSwing"];
CABasicAnimation *rotationAnimation = [CABasicAnimationanimationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumbernumberWithFloat:2*M_PI*0.722];
rotationAnimation.duration =
1.0f;
rotationAnimation.repeatCount =
MAXFLOAT;
rotationAnimation.autoreverses =
YES;
rotationAnimation.timingFunction = [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[self.pointerImageView.layeraddAnimation:rotationAnimation
forKey:nil];
用下面这种方法则只会花半个圆:
CGAffineTransform transform;
transform = CGAffineTransformRotate(self.pointerImageView.transform,2*M_PI*0.722);
[UIView beginAnimations:@"rotate" context:nil ];
[UIViewsetAnimationDuration:2];
[UIViewsetAnimationDelegate:self];
[self.pointerImageView setTransform:transform];
[UIView commitAnimations];
如果想动画执行一次后停止在当前位置 ,则应该这么做:
CABasicAnimation *rotationAnimation = [CABasicAnimation
animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber
numberWithFloat:2*M_PI*0.722];
rotationAnimation.duration =
1.5f;
rotationAnimation.repeatCount =
0;
rotationAnimation.autoreverses =
NO;
rotationAnimation.removedOnCompletion =
NO; //要实现完成动画后停止在当前位置
这个值应该设置成NO 然后下边的kCAFillModeForwards这个才会起作用
rotationAnimation.fillMode =
kCAFillModeForwards;
rotationAnimation.delegate =
self;
rotationAnimation.timingFunction = [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[self.pointerImageView.layer
addAnimation:rotationAnimation forKey:@"KeyStartSwing"];
相关文章推荐
- 做一个绕Y轴旋转的动画时遇到问题
- 关于个推“证书只能绑定一个bundleId”问题的解决办法
- 关于个推“证书只能绑定一个bundleId”问题的解决办法
- 信息异步处理,关于handle和thread交互信息,只能更改一个textview的问题原因分析
- 关于expdp在服务器上同时只能有一个进程在执行的问题
- Cocos-2d 关于多个CCSprite精灵播放同一个CCAction动画问题
- Cocos-2d 关于多个CCSprite精灵播放同一个CCAction动画问题
- 【微信支付】分享一个失败的案例 跨域405(Method Not Allowed)问题 关于IM的一些思考与实践 基于WebSocketSharp 的IM 简单实现 【css3】旋转倒计时 【Html5】-- 塔台管制 H5情景意识 --飞机 谈谈转行
- 解决动画效果只能旋转 180的问题
- 关于提示”XML 文档只能有一个顶层元素“问题的解决方法备忘
- 关于重装系统后,Windows和Linux双系统只能进入一个的问题
- 关于动画的一个小问题
- 关于Java继承一个值得思考的问题。
- 有关一个 iframe 的问题,关于在 iframe 内的页面内登录成功后,如何由当前页直接转到另一个页面内?
- 关于SQL的存储过程一个悬而未决的老问题
- 关于数据库备份的一个问题??
- 关于CreateService的一个大问题:权限问题
- 一个关于重定向的问题研究,应该具有实用性
- 一个关于Schema的问题,请求帮助
- 一个关于bin目录下DLL动态编译的问题