效果图
文章来源:https://www.toymoban.com/news/detail-736859.html
实现代码文章来源地址https://www.toymoban.com/news/detail-736859.html
- (void)setUpContraints
{
CGFloat topImageCentery = (SCREEN_HEIGHT - 370 * PLUS_SCALE) / 2;
[self.topIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(0);
make.centerY.equalTo(self.view.mas_top).with.offset(topImageCentery);
}];
[self.view layoutIfNeeded];
}
- (void)topAnimation
{
CASpringAnimation *springAnimation = [CASpringAnimation animationWithKeyPath:@"transform.scale"];
springAnimation.mass = 1.5;
springAnimation.stiffness = 400;
springAnimation.damping = 20;
springAnimation.initialVelocity = 0;
springAnimation.duration = 1;
springAnimation.fromValue = @0;
springAnimation.toValue = @1;
springAnimation.fillMode = kCAFillModeBoth;
springAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[self.topIconView.layer addAnimation:springAnimation forKey:nil];
}
到了这里,关于iOS实现弹簧放大动画的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!