基础动画

//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--动画基础的更多相关文章

  1. 动画基础--基于Core Animation(3)

    参考:https://zsisme.gitbooks.io/ios-/content/ 前面的文章动画基础--基于Core Animation(1),动画基础--基于Core Animation(2) ...

  2. iOS 动画基础总结篇

    iOS 动画基础总结篇   动画的大体分类(个人总结可能有误) 分类.png UIView 动画 属性动画 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 ...

  3. iOS Programming Controlling Animations 动画

    iOS Programming Controlling Animations 动画 The word "animation" is derived from a Latin wor ...

  4. iOS开发UI篇—核心动画(基础动画)

    转自:http://www.cnblogs.com/wendingding/p/3801157.html 文顶顶 最怕你一生碌碌无为 还安慰自己平凡可贵 iOS开发UI篇—核心动画(基础动画) iOS ...

  5. 《Programming WPF》翻译 第8章 1.动画基础

    原文:<Programming WPF>翻译 第8章 1.动画基础 动画包括在一段时间内改变用户界面的某些可见的特征,如它的大小.位置或颜色.你可以做到这一点,非常困难的通过创建一个tim ...

  6. 【2017-04-01】JS字符串的操作、时间日期的操作、函数、事件、动画基础

    一.字符串的操作 1.转大写: s.toLowerCase(); 2.转大写: s.toUpperCase(); 3.字符串的截取: s.substr(3,4);      -从索引3开始截取,截取4 ...

  7. 炫丽的倒计时效果Canvas绘图与动画基础

    前言 想要在自己做的网页中,加入canvas动画效果,但是发现模板各种调整不好,觉得还是要对canvas有所了解,才可以让自己的网页变得狂拽炫酷吊炸天! 一.绘制基础 1 <!DOCTYPE h ...

  8. 动画基础--基于Core Animation(2)

    参考:https://zsisme.gitbooks.io/ios-/content/ 前面的文章动画基础--基于Core Animation(1)提到了图层的基本概念以及可动画参数几何学等知识. 本 ...

  9. HTML5+JavaScript动画基础 完整版 中文pdf扫描版

    <HTML5+JavaScript动画基础>包括了基础知识.基础动画.高级动画.3D动画和其他技术5大部分,分别介绍了动画的基本概念.动画的JavaScript基础.动画中的三角学.渲染技 ...

  10. Expression Blend学习动画基础

    原文:Expression Blend学习动画基础 什么是动画(Animation)? 动画就是时间+换面的组合,画面跟着时间变化.最常见的是flash的动画,还有GIF动态图片. 动画的主要元素 时 ...

随机推荐

  1. Hbse的读写过程

    1.Hbase的读取过程. 以读取test_region表,row key为this is row value 400000为例. 1: 到zookeeper中去读取/hbase/root-regio ...

  2. Linux配置防火墙8080端口

    1.查看防火墙状态,哪些端口开放了 /etc/init.d/iptables status 2.配置防火墙 vi /etc/sysconfig/iptables ################### ...

  3. ZWave for Arduino

    https://sites.google.com/site/arduinozwave/http://www.ebay.com/sch/i.html?_trksid=p2050601.m570.l131 ...

  4. PL/SQL在win7X 64下安装

    oracle11g怎么安装在此不作说明,网上到处都是,主要针对PL/SQL的安装配置 下载地址: PLSQL Developer: http://pan.baidu.com/s/1nt7G4cD X6 ...

  5. VS预生成事件命令行 和 生成后事件命令行

    宏                                                      说明 $(ConfigurationName)            当前项目配置的名称( ...

  6. C#导出DataGridView到Excel

    public class ExcelHelper { private static object missing = Type.Missing; #region ================导出= ...

  7. dom操作中的js优化

    频繁地对于DOM进行操作的很是损耗性能,但在富网页应用中我们编写脚本无可避免地要跟DOM打交道,到底怎么才能优化这个性能瓶颈呢,大致从以下三种情况去考虑: 访问和修改DOM元素 修改DOM样式,会造成 ...

  8. 初识--Ajax & Json

    1,AJAX是一种进行页面局部异步刷新技术. 用AJAX向服务器发送请求和获得服务器返回的数据并更新到页面中. 不是刷新整个页面,而是在HTML页面中使用JavaScript创建XMLHTTPRequ ...

  9. iOS UILable高度自适应

    适用于iOS6以后 NSString *tip = @"UILable高度自适应,UILable高度自适应,UILable高度自适应"; UILabel label_2 = [[U ...

  10. Part 32 Abstract classes in c#