我想问一下如何实现以下数字动画?希望你能帮助我,谢谢!
可以用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];
答案 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];
随意修改值以制作动画。