CAMediaTimingFunction的使用

CAMediaTimingFunction可以用在POP动画的自定义动画当中,算是非常实用的工具,当然,系统的动画也是可以使用的.

效果:

需要用到的工具:

https://github.com/YouXianMing/Tween-o-Matic-CN

测试用源码:

//
// ViewController.m
// CoreAnimation
//
// Created by XianMingYou on 15/4/13.
// Copyright (c) 2015年 XianMingYou. All rights reserved.
// #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad]; // 初始化layer
CALayer *layer = [CALayer layer];
layer.frame = CGRectMake(, , , );
layer.backgroundColor = [UIColor blackColor].CGColor; // 终点位置
CGPoint endPosition = CGPointMake(layer.position.x, layer.position.y + ); // 动画
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
animation.fromValue = [NSValue valueWithCGPoint:layer.position];
animation.toValue = [NSValue valueWithCGPoint:endPosition];
animation.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.20 :0.03 :0.13 :1.00];
layer.position = endPosition;
animation.duration = .f; // 添加动画
[layer addAnimation:animation forKey:nil]; // 添加layer
[self.view.layer addSublayer:layer];
} @end

需要注意的细节:

最新文章

  1. datatables服务器端分页要点
  2. xcode svn commit is not under version control (1) & git commit
  3. 【IOS 开发】Object - C 入门 之 数据类型详解
  4. javaweb学习总结—Apache的DBUtils框架学习
  5. BootStrap 模态框基本用法
  6. 5 Ways to Learn and Remember Absolutely Anything
  7. iOS开发——网络编程Swift篇&(一)网络监测
  8. Jmeter实现WebSocket协议的接口和性能测试方法
  9. JavaScript中对数组的操作
  10. js的阻塞特性
  11. try{} catch(…){} 讨论(转)
  12. 用phpcms切换中英文网页的方法(不用解析二级域名)、phpcms完成pc和手机端切换(同一域名)
  13. Unity GC 优化要点
  14. Asp.net Core 使用Jenkins + Dockor 实现持续集成、自动化部署(三):搭建jenkins集群环境
  15. 二进制按位与(&) 按位或(|)  异或运算(^)
  16. Go语言基础:method
  17. CentOS安装crontab 定时备份文件夹
  18. C-main函数剖析。
  19. CKFinder 弹出窗口操作并设置回调函数
  20. 《转》python学习(4)对象

热门文章

  1. SASS的安装和转换为CSS的方法
  2. 再学C/C++ 之 指针常量 和 常量指针
  3. rpm: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory解决办法
  4. [心平气和读经典]The TCP/IP Guide(002)
  5. 使用VMware安装CentOS7详请
  6. redis数据类型(六)Sorted set类型
  7. [Mysql 查询语句]——对查询结果进一步的操作
  8. Uboot流程分析
  9. 一些Android的博客,没事翻翻
  10. OpenStack概述