[BS-26] UIViewpop和Core Animation区别
Posted stevenwuzheng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[BS-26] UIViewpop和Core Animation区别相关的知识,希望对你有一定的参考价值。
UIView、pop和Core Animation区别
一、UIView、pop和Core Animation的主要区别
1. Core Animation的动画只能添加到layer上(layer.position和view.frame类似)
2. pop的动画能添加到任何对象
3. pop的底层并非基于Core Animation, 是Facebook用OC和C++开发的基于CADisplayLink动画
4. Core Animation的动画仅仅是表象, 并不会真正修改对象的frame\size等值,通常用在不需要与用户交互的动画(如转场动画/下载进度动画)
5. pop和UIView实现的动画实时修改对象的属性, 真正地修改了对象的属性
二、pop动画应用举例
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
anim.springBounciness = 20;
anim.springSpeed = 20;
anim.fromValue = [NSValue valueWithCGPoint:CGPointMake(100, 100)];
anim.toValue = [NSValue valueWithCGPoint:CGPointMake(200, 200)];
[self.sloganView pop_addAnimation:anim forKey:nil];
POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerPositionY];
anim.beginTime = CACurrentMediaTime() + 1.0;
anim.springBounciness = 20;
anim.springSpeed = 20;
anim.fromValue = @(self.sloganView.layer.position.y);
anim.toValue = @(300);
anim.completionBlock = ^(POPAnimation *anim, BOOL finished){
NSLog(@"-----动画结束");
};
[self.sloganView.layer pop_addAnimation:anim forKey:nil];
}
三、pop学习资料
1. https://github.com/facebook/pop
2. https://github.com/schneiderandre/popping
3. https://github.com/MartinRGB/LearnCube-ios
以上是关于[BS-26] UIViewpop和Core Animation区别的主要内容,如果未能解决你的问题,请参考以下文章
[An Introduction to GCC 学习笔记] 11 core文件分析
MySql Scaffolding an Existing Database in EF Core
asp.net core发布到iis后出现An error occurred while starting the application
Tomcat启动问题:严重[main] org.apache.catalina.core.AprLifecycleListener.init An incompatible version...
Create an ASP.NET Core web app in Visual Studio Code
ERROR conda.core.link:_execute(502): An error occurred while installing package ‘conda-forge::setupt