Animations--动画基础
基础动画
//1.在0.5s内,将_field.alpha 的数值变为1.0
[UIView animateWithDuration:0.5 animations:^{
_field.alpha = 1.0;
}];
//2. 较1,在动画完成后,输出log:animation finished!
[UIView animateWithDuration:0.5 animations:^{
_field.alpha = 1.0;
} completion:^(BOOL finished) {
NSLog(@"animation finished!");
}];
//3. 较2,动画在该行代码执行后,延迟0.5s执行
// options: 动画时间曲线项,常用如下:
// UIViewAnimationOptionCurveEaseInOut = 0 << 16, // default
// UIViewAnimationOptionCurveEaseIn = 1 << 16,
// UIViewAnimationOptionCurveEaseOut = 2 << 16,
// UIViewAnimationOptionCurveLinear = 3 << 16,
// UIViewAnimationOptionAllowUserInteraction = 1 << 1, // turn on user interaction while animating
// UIViewAnimationOptionBeginFromCurrentState = 1 << 2, // start all views from current value, not initial value
// UIViewAnimationOptionRepeat = 1 << 3, // repeat animation indefinitely
// UIViewAnimationOptionAutoreverse = 1 << 4, // if repeat, run animation back and forth
[UIView animateWithDuration:0.5 delay:0.5 options:UIViewAnimationOptionCurveLinear animations:^{
_field.alpha = 1.0;
} completion:^(BOOL finished){
NSLog(@"animation finished!");
}];
//4. 较3,动画附带一定的弹簧效果,IOS7+;
// usingSpringWithDamping: 阻尼率,0.0~1.0,越小振荡效果越明显
// initialSpringVelocity: 用于改变动画的初始速率,比如:_field.在X轴上 会以200pt/s 变化,而你想要的效果为100pt/s, 则可设置其值为0.5; 一般情况下,设置为0(即不做处理)较合适
// 推荐使用该动画方法
[UIView animateWithDuration:0.5 delay:0.5 usingSpringWithDamping:0.5 initialSpringVelocity:0.5 options:UIViewAnimationOptionCurveLinear animations:^{
} completion:^(BOOL finished){
NSLog(@"animation finished!");
}];
关键帧动画
//较基础动画,可在一个动画中控制UIView的属性值发生多段变化。
// options: 动画时间曲线项,常用如下:
// UIViewKeyframeAnimationOptionCalculationModeLinear = 0 << 10, // default
// UIViewKeyframeAnimationOptionCalculationModeDiscrete = 1 << 10,
// UIViewKeyframeAnimationOptionCalculationModePaced = 2 << 10,
// UIViewKeyframeAnimationOptionCalculationModeCubic = 3 << 10,
// UIViewKeyframeAnimationOptionCalculationModeCubicPaced = 4 << 10,
// UIViewKeyframeAnimationOptionAllowUserInteraction = UIViewAnimationOptionAllowUserInteraction, // turn on user interaction while animating
// UIViewKeyframeAnimationOptionBeginFromCurrentState = UIViewAnimationOptionBeginFromCurrentState, // start all views from current value, not initial value
// UIViewKeyframeAnimationOptionRepeat = UIViewAnimationOptionRepeat, // repeat animation indefinitely
// UIViewKeyframeAnimationOptionAutoreverse = UIViewAnimationOptionAutoreverse, // if repeat, run animation back and forth
[UIView animateKeyframesWithDuration:0.5 delay:0.5 options:UIViewKeyframeAnimationOptionCalculationModeDiscrete animations:^{
//关键帧1
// addKeyframeWithRelativeStartTime: 相对起始时间
// relativeDuration: 相对执行时间
[UIView addKeyframeWithRelativeStartTime:0 relativeDuration:0.8 animations:^{
_field.alpha = 1.0;
}];
//关键帧2
[UIView addKeyframeWithRelativeStartTime:0.8 relativeDuration:0.2 animations:^{
_field.alpha = 0.5;
}];
} completion:^(BOOL finished){
NSLog(@"animation finished!");
}];
Animations--动画基础的更多相关文章
- 动画基础--基于Core Animation(3)
参考:https://zsisme.gitbooks.io/ios-/content/ 前面的文章动画基础--基于Core Animation(1),动画基础--基于Core Animation(2) ...
- iOS 动画基础总结篇
iOS 动画基础总结篇 动画的大体分类(个人总结可能有误) 分类.png UIView 动画 属性动画 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 ...
- iOS Programming Controlling Animations 动画
iOS Programming Controlling Animations 动画 The word "animation" is derived from a Latin wor ...
- iOS开发UI篇—核心动画(基础动画)
转自:http://www.cnblogs.com/wendingding/p/3801157.html 文顶顶 最怕你一生碌碌无为 还安慰自己平凡可贵 iOS开发UI篇—核心动画(基础动画) iOS ...
- 《Programming WPF》翻译 第8章 1.动画基础
原文:<Programming WPF>翻译 第8章 1.动画基础 动画包括在一段时间内改变用户界面的某些可见的特征,如它的大小.位置或颜色.你可以做到这一点,非常困难的通过创建一个tim ...
- 【2017-04-01】JS字符串的操作、时间日期的操作、函数、事件、动画基础
一.字符串的操作 1.转大写: s.toLowerCase(); 2.转大写: s.toUpperCase(); 3.字符串的截取: s.substr(3,4); -从索引3开始截取,截取4 ...
- 炫丽的倒计时效果Canvas绘图与动画基础
前言 想要在自己做的网页中,加入canvas动画效果,但是发现模板各种调整不好,觉得还是要对canvas有所了解,才可以让自己的网页变得狂拽炫酷吊炸天! 一.绘制基础 1 <!DOCTYPE h ...
- 动画基础--基于Core Animation(2)
参考:https://zsisme.gitbooks.io/ios-/content/ 前面的文章动画基础--基于Core Animation(1)提到了图层的基本概念以及可动画参数几何学等知识. 本 ...
- HTML5+JavaScript动画基础 完整版 中文pdf扫描版
<HTML5+JavaScript动画基础>包括了基础知识.基础动画.高级动画.3D动画和其他技术5大部分,分别介绍了动画的基本概念.动画的JavaScript基础.动画中的三角学.渲染技 ...
- Expression Blend学习动画基础
原文:Expression Blend学习动画基础 什么是动画(Animation)? 动画就是时间+换面的组合,画面跟着时间变化.最常见的是flash的动画,还有GIF动态图片. 动画的主要元素 时 ...
随机推荐
- 用户体验测试(UE测试)
用户体验测试(UE测试) 在测试周期早些时候就开始用户体验测试很明智.多数人往往会把UE测试放在最后,但UE测试可以揭示很多问题,如外观.字体.文本颜色.背景颜色.内容.布局等,还可以在测试周期尽可能 ...
- 绝对好评的淘宝购物导航:baiso.uz.taobao.com
绝对好评的淘宝购物导航:baiso.uz.taobao.com 绝对好评的淘宝购物导航--百搜:http://baiso.uz.taobao.com
- PHP分页
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- PAT1003——我要通过!
“答案正确”是自动判题系统给出的最令人欢喜的回复.本题属于PAT的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”. 得到“答案正确”的条件是: 1 ...
- 查询sql 并且读取
//显示地址 //VBSBegin // Set obj = GetObject("winmgmts:\\.\root\cimv2") // Set IPConfigSet = o ...
- Runtime学习与使用(一):为UITextField添加类目实现被键盘遮住后视图上移,点击空白回收键盘
OC中类目无法直接添加属性,可以通过runtime实现在类目中添加属性. 在学习的过程中,试着为UITextField添加了一个类目,实现了当TextField被键盘遮住时视图上移的功能,顺便也添加了 ...
- Windows下用cmd命令安装及卸载服务
第一种方法: 1. 开始 ->运行 ->cmd2. cd到C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727(Framework版本号按IIS配置) ...
- (转)一网打尽当下NoSQL类型、适用场景及使用公司
摘要:对比传统关系型数据库,NoSQL有着更为复杂的分类——键值.面向文档.列存储以及图数据库.这里就带你一览NoSQL各种类型的适用场景及一些知名公司的方案选择. 在过去几年,关系型数据库一直是数据 ...
- KOBEV / KOBED
check the highlighted. the number of execution. if too high, can be the requirement was all met. whi ...
- .NET4.5可以给所有线程设置默认的Culture了
How to set CurrentCulture for all threads in a domain in .NET 4.5 Before .NET 4.5 if we wanted to se ...