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动态图片. 动画的主要元素 时 ...
随机推荐
- POJ 2421 Constructing Roads (最小生成树)
Constructing Roads Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u ...
- HDU 1069 Monkey and Banana (DP)
Monkey and Banana Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- IOS学习网站
http://www.cocoachina.com http://onevcat.com/#blog http://objccn.io http://blog.devtang.com http://b ...
- 转: 数字证书原理 https 完整过程解析
点评: 讲的非常的详细与全面,值得一看. 转: http://www.cnblogs.com/JeffreySun/archive/2010/06/24/1627247.html 文中首先解释了加密解 ...
- 【转】关于loadrunner中设置进程和线程的区别
loadrunner中,在进行运行设置中有一项选择,是按进程运行Vuser或按线程运行Vuser?下面进行分别来讲: 1.按进程运行Vuser:Controller将使用驱动程序mdrv运行Vuser ...
- tmux使用
1.配置文件的使用 在~/.tmux.conf中添加: setw -g mouse-resize-pane on setw -g mouse-select-pane on setw -g mouse- ...
- Java程序修改文件名
package script; import java.io.File; import java.io.IOException; public class Realname { public stat ...
- 【转载】Hadoop可视化分析利器之Hue
http://qindongliang.iteye.com/blog/2212619 先来看下hue的架构图: (1)Hue是什么? Hue是一个可快速开发和调试Hadoop生态系统各种应用的一个基 ...
- asp.net渐变
简介:第一个参数代表渐变的方向,后面的StartColorStr和End就不用解释了: filter: progid:DXImageTransform.Microsoft.Gradient(Gradi ...
- HTML_创建易用的Web表单
首先创建一个表单域集合fieldset fieldset元素允许Web开发者将主题相关的表单组合在一起 <fieldset></fieldset> 要说明的是本例子中每个表单都 ...