用POP动画引擎实现弹簧动画(POPSpringAnimation)
效果图:

#import "ViewController.h"
#import <POP.h> @interface ViewController () @property (nonatomic, weak) UIView *testView; @end @implementation ViewController - (void)viewDidLoad
{
[super viewDidLoad]; self.view.backgroundColor = [UIColor blackColor]; // 初始化测试控件
UIView *testView = [[UIView alloc] initWithFrame:CGRectMake(, , , )];
testView.center = self.view.center;
testView.backgroundColor = [UIColor redColor];
self.testView = testView;
[self.view addSubview:testView];
} - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
// 初始化弹簧动画
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds];
springAnimation.springSpeed = ; // 设置动画速度(常用)
springAnimation.springBounciness = ; // 设置弹性大小(常用)
// springAnimation.dynamicsFriction = 10; // 设置阻止弹性的阻力(选用)
// springAnimation.dynamicsTension = 100; // 设置弹性的张力(可以理解为每次变大的程度, 选用)
if (self.testView.frame.size.width == ) {
springAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(, , , )];
} else {
springAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(, , , )];
} // 添加动画
[self.testView.layer pop_addAnimation:springAnimation forKey:nil];
} @end
github:https://github.com/RinpeChen/POPSpringAnimationDemo
用POP动画引擎实现弹簧动画(POPSpringAnimation)的更多相关文章
- 用POP动画引擎实现衰减动画(POPDecayAnimation)
效果图: #import "ViewController.h" #import <POP.h> @interface ViewController () @end @i ...
- [译]理解 Windows UI 动画引擎
本文译自 Nick Waggoner 的 "Understand what’s possible with the Windows UI Animation Engine",已获原 ...
- pop弹簧动画实现
POP是一个在iOS与OS X上通用的极具扩展性的动画引擎.它在基本的静态动画的基础上增加的弹簧动画与衰减动画,使之能创造出更真实更具物理性的交互动画.POP的API可以快速的与现有的ObjC代码集成 ...
- 聊聊动画引擎 pop
iOS可以通过CADisplayLink实现自定义动画引擎,pop就是基于此实现的,而且比原生Core Animation更强大好用.譬如当ViewController侧滑返回的时候,系统会将Core ...
- POP动画引擎中Layer与CALayer的一点区别
POP动画引擎是facebook提供的一个开源框架, 可以实现很多的动画效果, 这里就不一一介绍啦, 有兴趣的童鞋请移步: https://github.com/facebook/pop 下面简单的讲 ...
- CADisplayLink+弹簧动画实现果冻效果
项目中在Tabbar中间的按钮要从底部弹出视图并有果冻效果,在CocoaChina中找了一篇博客用 UIBezierPath 实现果冻效果,github,自己就按着上面的demo修改了一下( 之前也是 ...
- SpriteSheet精灵动画引擎
SpriteSheet精灵动画引擎 本文介绍Flash中SpriteSheet精灵序列图与其它渲染方式的性能对比.SpriteSheet的原理及注意实现,最后实现了一个精灵序列图的渲染引擎.本文的 ...
- [范例] Firemonkey 弹簧动画
弹簧动画效果: 不用写任何代码,只需设定下面动画属性: 参考动画曲线: http://monkeystyler.com/guide/Interpolation-and-AnimationType-Il ...
- Unity3d动画脚本 Animation Scripting(深入了解游戏引擎中的动画处理原理)
也许这一篇文章的内容有点枯燥,但我要说的是如果你想深入的了解游戏引擎是如何处理动画片断或者素材并 让玩家操控的角色动起来栩栩如生,那么这真是一篇好文章(当然我仅仅是翻译了一下) 动画脚本 Anim ...
随机推荐
- iOS程序-UIScrollView的基本使用
iOS程序-UIScrollView的基本使用 scrollView的几个属性contentSize contentOffset contentInset 1.不能向上滑动很可能是因为contentS ...
- Solr4.8.0源码分析(10)之Lucene的索引文件(3)
Solr4.8.0源码分析(10)之Lucene的索引文件(3) 1. .si文件 .si文件存储了段的元数据,主要涉及SegmentInfoFormat.java和Segmentinfo.java这 ...
- 扯谈spring mvc之WebApplicationContext的继承关系
spring mvc里的root/child WebApplicationContext的继承关系 在传统的spring mvc程序里会有两个WebApplicationContext,一个是pare ...
- UVALive 4394 String painter
这题搞了很久很久..弄得我都不想放上来了,但是想了想还是写上来吧,万一以后忘了怎么做了,又得搞很久很久了.题目是要求把一个字符串变成另外一个,每次可以选择一段字符串变成同一个字符,问最少用变多少次.本 ...
- 【HDOJ】1510 White Rectangles
这个题目很好,变形的题目也很多.简单DP. /* 1510 */ #include <cstdio> #include <cstring> #include <cstdl ...
- 【HDOJ】2416 Treasure of the Chimp Island
bfs().题目的数据乱码.应该如下: *****#********* *.......$...* *..***.......* *....*****..* *....******37A *****. ...
- CentOS 启动提示unexpected inconsistency;RUN fsck MANUALLY
CentOS这两天服务器出了问题了,提示如下: unexpected inconsistency;RUN fsck MANUALLY An error occurred during the file ...
- COALESCE函数
--SQL学习笔记一 --函数coalesce --功能返回参数中第一个非NULL值 --语法 COALESCE ( expression [ ,n ] ) --创建测试表 IF OBJECT_ID( ...
- Perl数据库DBI接口简介【转载】
本文转载自:http://blog.csdn.net/like_zhz/article/details/5441946 ######################################## ...
- Java学习日记-6 继承
继承1.基本介绍 面向对象程序设计三大原则之一.被继承的称为父类,继承类称为子类.关键字:extends例子: class TwoDshape{ double width; double height ...