iOS如何让图片有阻尼的旋转
伊谢尔伦
伊谢尔伦 2017-04-17 11:36:46
0
3
312

想让图片有阻尼的旋转,然后停下来,该怎么做?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全部回覆(3)
左手右手慢动作

UIViewAnimationOptionCurveEaseOut
An ease-out curve causes the animation to begin quickly, and then slow as it completes.

迷茫

keyframe animation

CALayer *layer = rotatingImage.layer;
CAKeyframeAnimation *animation;
animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
animation.duration = 0.5f;
animation.cumulative = YES;
animation.repeatCount = 1;
animation.values = [NSArray arrayWithObjects:   	// i.e., Rotation values for the 3 keyframes, in RADIANS
	  [NSNumber numberWithFloat:0.0 * M_PI], 
	  [NSNumber numberWithFloat:0.75 * M_PI], 
	  [NSNumber numberWithFloat:1.5 * M_PI], nil]; 
animation.keyTimes = [NSArray arrayWithObjects:     // Relative timing values for the 3 keyframes
	  [NSNumber numberWithFloat:0], 
	  [NSNumber numberWithFloat:.5], 
	  [NSNumber numberWithFloat:1.0], nil]; 
animation.timingFunctions = [NSArray arrayWithObjects:
	  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],	// from keyframe 1 to keyframe 2
	  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut], nil];	// from keyframe 2 to keyframe 3
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;

[layer addAnimation:animation forKey:nil];
伊谢尔伦

这应该就是你要的效果: https://github.com/rdsquared09/Circul...

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!