#仿微博弹簧动画git
老玩微博,最近在研究动画,周末抽空写了个发微博的动画github
//开始时让全部按钮都移动到最底部 btn.transform = CGAffineTransformMakeTranslation(0, self.view.bounds.size.height); //添加定时器 self.timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(update) userInfo:nil repeats:YES]; - (void)update{ if (self.btnIndex == self.btnArray.count) { [self.timer invalidate]; return ; } VerticalStyleButton *button = self.btnArray[self.btnIndex]; //弹簧动画 [UIView animateWithDuration:0.3 delay:0.2 usingSpringWithDamping:0.8 initialSpringVelocity:0 options:UIViewAnimationOptionCurveLinear animations:^{ button.transform = CGAffineTransformIdentity; } completion:^(BOOL finished) { }]; self.btnIndex++; } [UIView animateWithDuration:0.25 animations:^{ button.transform = CGAffineTransformMakeScale(1.2, 1.2); }]; [UIView animateWithDuration:0.25 animations:^{ button.alpha = 0; button.transform = CGAffineTransformMakeScale(2, 2); }];
源码地址布局