2016-06-11 4 views
-2

Я хочу спросить, как реализовать следующую анимацию чисел? Надеюсь, вы можете мне помочь, спасибо!Как реализовать следующую анимацию?

enter image description here

можно использовать facebook поп, чтобы достичь этого?

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

Не могли бы вы разработать и показать код? –

+1

Вы можете использовать весеннюю анимацию для изменения масштаба. Это в основном все. Нет необходимости в 'PopSpring', на' UIView' есть родные анимации весны. – Sulthan

ответ

0

Вы должны взглянуть на aimateKeyFrames. Вот пример кода, который поможет вам понять.

Вы можете попробовать сначала установить ярлык на большой размер, который вы найдете хорошим. А затем

[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]; 

Измените значения, чтобы сделать анимацию по своему усмотрению.

Смежные вопросы