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动态图片. 动画的主要元素 时 ...
随机推荐
- CF Set of Strings
Set of Strings time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- CF 208E - Blood Cousins dfs序+倍增
208E - Blood Cousins 题目:给出一棵树,问与节点v的第k个祖先相同的节点数有多少个. 分析: 寻找节点v的第k个祖先,这不就是qtree2简化版吗,但是怎么统计该祖先拥有多少个深度 ...
- SQL的内连接与外连接
转自:http://blog.csdn.net/killerggf/article/details/6216102 有两个表A和表B. 表A结构如下: Aid:int:标识种子,主键,自增ID ...
- DataTable转CSV
直接上方法: /// <summary> /// 将DataTable转换成CSV文件 /// </summary> /// <param name="dt&q ...
- ASP流程控制语句
ASP流程控制语句 1.if...then语句 单行: if 条件 then 语句 多行: if 条件 then elseif 条件 then 语句 elseif 条件 then 语句 else en ...
- HTML5_用语义化标记重新定义博客
HTML5文档的第一行便是文档类型声明,文档类型声明的作用有两个 一:验证器依据文档类型来判断采用何种验证规则去验证代码 二:文档类型声明能够强制IE6,IE7,IE8以“标准模式”渲染页面 1: & ...
- Java关键字及其作用
Java关键字及其作用 一. 关键字总览 访问控制 private protected public 类,方法和变量修饰符 abstract class extends fin ...
- HTTP Status 500 - An exception occurred processing JSP page /WEB-INF
HTTP Status 500 - An exception occurred processing JSP page /WEB-INF/test/showCountry.jsp at line 11 ...
- UIScrollView,UIPageControl
#import <UIKit/UIKit.h> @interface ViewController : UIViewController<UIScrollViewDelegate&g ...
- 《通过脚本查看哪些ip被占用》shell笔记
改脚本查看哪些ip被占用. #!/bin/bash for i in {1..10} //赋予i变量1-10 do //干什么 ping -c1 -w1 192.168.7.$i && ...