CAMediaTimingFunction的使用
2024-08-25 02:30:43
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
需要注意的细节:
最新文章
- datatables服务器端分页要点
- xcode svn commit is not under version control (1) &; git commit
- 【IOS 开发】Object - C 入门 之 数据类型详解
- javaweb学习总结—Apache的DBUtils框架学习
- BootStrap 模态框基本用法
- 5 Ways to Learn and Remember Absolutely Anything
- iOS开发——网络编程Swift篇&;(一)网络监测
- Jmeter实现WebSocket协议的接口和性能测试方法
- JavaScript中对数组的操作
- js的阻塞特性
- try{} catch(…){} 讨论(转)
- 用phpcms切换中英文网页的方法(不用解析二级域名)、phpcms完成pc和手机端切换(同一域名)
- Unity GC 优化要点
- Asp.net Core 使用Jenkins + Dockor 实现持续集成、自动化部署(三):搭建jenkins集群环境
- 二进制按位与(&;) 按位或(|)  异或运算(^)
- Go语言基础:method
- CentOS安装crontab 定时备份文件夹
- C-main函数剖析。
- CKFinder 弹出窗口操作并设置回调函数
- 《转》python学习(4)对象
热门文章
- SASS的安装和转换为CSS的方法
- 再学C/C++ 之 指针常量 和 常量指针
- rpm: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory解决办法
- [心平气和读经典]The TCP/IP Guide(002)
- 使用VMware安装CentOS7详请
- redis数据类型(六)Sorted set类型
- [Mysql 查询语句]——对查询结果进一步的操作
- Uboot流程分析
- 一些Android的博客,没事翻翻
- OpenStack概述