iOS Animation各种动画效果
2016-06-01 14:57
399 查看
//图片进度显示效果,什么时间点显示到什么程度
//图片从无到有显示动画效果
//图片显示的各种动画效果
//图片位移之惯性效果
CAKeyframeAnimation* animation = [CAKeyframeAnimation animationWithKeyPath:@"strokeEnd"]; animation.duration = 1; animation.values = @[@(0), @(1),@(0.75)]; animation.keyTimes = @[@(0), @(0.6), @(1)]; animation.repeatCount = 1; [animation setRemovedOnCompletion:NO]; animation.fillMode = kCAFillModeForwards; [_imageView.layer addAnimation:animation forKey:nil];
//图片从无到有显示动画效果
CABasicAnimation *basicAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; basicAnimation.duration = 2; basicAnimation.fromValue = [NSNumber numberWithInteger:0]; basicAnimation.toValue = [NSNumber numberWithInteger:1]; [layer addAnimation:basicAnimation forKey:@"strokeEnd"]; [_imageView.layer addSublayer:layer];
//图片显示的各种动画效果
CATransition *animation = [CATransition animation]; [animation setDuration:1.0]; [animation setFillMode:kCAFillModeForwards]; [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]]; [animation setType:@"rippleEffect"];//@"cube" @"moveIn" @"reveal" @"fade"(default) @"pageCurl" @"pageUnCurl" @"suckEffect" @"rippleEffect" @"oglFlip" [animation setSubtype:kCATransitionFromTop]; [_imageView.layer addAnimation:animation forKey:nil];
//图片位移之惯性效果
CASpringAnimation *animation = [CASpringAnimation animationWithKeyPath:@"position.x"]; animation.damping = 5; animation.stiffness = 100; animation.mass = 1; animation.initialVelocity = 0; animation.fromValue = _imageView.layer.position.x; animation.toValue = _imageView.layer.position.x+200; animation.duration = 3; [_imageView.layer addAnimation:animation forKey:nil];
相关文章推荐
- 发布IOS产品被拒后如何再上传新发布包
- About Files and Directories(iOS文件与目录)
- iOS tableView背景图和cell背景图
- 【框架】iOS框架研究
- 分析iOS Crash文件
- iOS中如何让多个空格替换成一个空格
- iOS AES加密流程,AES加密的几个参数
- 正确使用iOS常量(const)、enum以及宏(#define)在iOS开发中请尽量多使用const、enum来代替宏定义(#define);随着项目工程的逐渐增大,过多的宏定义还可能影响项目的编译
- iOS 自定义分区头加上图片 以及导航控制器 颜色随滑动改变
- 正确使用iOS常量(const)、enum以及宏(#define)
- iOS 相机拍照声音消失方法
- iOS 获取今年指定月的天数
- iOS 使用CocoaPods过程中的几个问题
- GCD队列组
- 禁止 iOS 浏览器 自动识别拨号
- ios性能测试Instruments
- iOS 在已有项目添加CoreData
- 了解一下ffmpeg
- Xcode真机调试bug集(有待更新)
- iOS测试使用的ipa包快速打包方法