标签:
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实现的动画实时修改对象的属性, 真正地修改了对象的属性
- (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];
}
1. https://github.com/facebook/pop
2. https://github.com/schneiderandre/popping
3. https://github.com/MartinRGB/LearnCube-iOS
[BS-26] UIView、pop和Core Animation区别
标签:
原文地址:http://www.cnblogs.com/stevenwuzheng/p/5523252.html