地址:https://github.com/facebook/pop
pop和Core Animation的区别
1.Core Animation动画只能添加到layer上
2.pop的动画能添加到任何对象
3.pop的底层并非基于Core Animation,是基于CADisplayLink
4.Core Animation的动画仅仅是表象,并不会真正修改对象的frame\size等值
5.pop动画实时修改对象的属性,真正地修改了对象的属性
示例1:给sloganView
对象做改变中心点的弹簧效果动画
POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
anim.springBounciness = 20;
anim.fromValue = [NSValue valueWithCGPoint:CGPointMake(100, 100)];
anim.toValue = [NSValue valueWithCGPoint:CGPointMake(200,200)];
[self.sloganView pop_addAnimation:anim forKey:nil];
示例2:给sloganView
做Y轴方向上的弹簧动画
POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerPositionY];
anim.beginTime = CACurrentMediaTime() + 1.0;
anim.springBounciness = 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];