如何实现以下动画?

时间:2016-06-11 16:03:08

标签: ios objective-c animation

我想问一下如何实现以下数字动画?希望你能帮助我,谢谢!

enter image description here

可以用facebook pop来实现吗?

POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds];
springAnimation.springSpeed         = 0;
springAnimation.springBounciness    = 20;
if (self.testView.frame.size.width == 100) {
    springAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 50, 50)];
} else {
    springAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 100, 100)];
}
[self.testView.layer pop_addAnimation:springAnimation forKey:nil];

1 个答案:

答案 0 :(得分:0)

你应该看看animateKeyFrames。这是一个可以帮助您理解的示例代码。

您可以尝试将标签设置为您认为合适的大尺寸。然后

[UIView animateKeyframesWithDuration:duration delay:delay options:0 animations:^{
    [UIView addKeyframeWithRelativeStartTime:0 relativeDuration:frameDuration animations:^{
        //decrease view size to a really small size by changing its frame of using CGAffineTransform
    }];
    [UIView addKeyframeWithRelativeStartTime:0.5 relativeDuration:frameDuration animations:^{
        //increase view size again to make it larger again to an appropriate size
    }];
} completion:nil];

随意修改值以制作动画。

相关问题