铺界面的时候加上这个动画效果,所有的视图会依次呈现
1
2
3
4
5
6
7
8
9
| //todo 这儿是要创建的一些视图,比如10个view
//ADD APPEAR ANIMATION
POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPViewAlpha];
anim.springBounciness = 8;//弹跳性能,0-20越大弹跳效果越好
anim.springSpeed = 4;//
anim.toValue = @(1.0);
anim.beginTime = CACurrentMediaTime()+0.1*tag;//出现时间
[view pop_addAnimation:anim forKey:@"appear"];
|
BoundsAnimation,下面的动画是把一个圆形变成了椭圆形
1
2
3
4
5
6
7
8
9
10
11
| POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds];
CGFloat amount = 80.0;
if (CGRectGetHeight(view.frame) == CGRectGetWidth(view.frame)) {
anim.toValue = [NSValue valueWithCGRect:CGRectInset(view.frame, -amount, 0)];
anim.springBounciness = 18;
} else {
anim.toValue = [NSValue valueWithCGRect:CGRectMake(720, 180, 80, 80)];
}
anim.springSpeed = 10;
[view.layer pop_addAnimation:anim forKey:@"popBounds"];
|
XRotationAnimation
记录下这个是想为写硬币动画的同学有一些帮助
1
2
3
4
5
6
| POPBasicAnimation *anim = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerRotationY];
anim.duration = 1.0;
anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
view.layer.anchorPoint = CGPointMake(0.5, 0.5);
anim.toValue = @(2*M_PI);
[view.layer pop_addAnimation:anim forKey:@"popRotationY"];
|
PS:
anchorPoint,不得不说这篇文章介绍的太详细啦:http://www.tuicool.com/articles/MvI7fu3
原创作品,转载请注明出处,谢谢。