iOS实现弹簧放大动画

效果图

实现代码

复制代码
- (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];
}
相关推荐
mascon1 小时前
U3D打包IOS的自我总结
ios
名字不要太长 像我这样就好1 小时前
【iOS】继承链
macos·ios·cocoa
karshey2 小时前
【IOS webview】IOS13不支持svelte 样式嵌套
ios
潜龙95272 小时前
第4.3节 iOS App生成追溯关系
macos·ios·cocoa
游戏开发爱好者811 小时前
iOS App 电池消耗管理与优化 提升用户体验的完整指南
android·ios·小程序·https·uni-app·iphone·webview
神策技术社区18 小时前
iOS 全埋点点击事件采集白皮书
大数据·ios·app
wuyoula18 小时前
iOS V2签名网站系统源码/IPA在线签名/全开源版本/亲测
ios
2501_9159184119 小时前
iOS 性能监控工具全解析 选择合适的调试方案提升 App 性能
android·ios·小程序·https·uni-app·iphone·webview
fishycx19 小时前
iOS 构建配置与 AdHoc 打包说明
ios
90后的晨仔20 小时前
ios 集成阿里云的AI智能体报错CocoaPods could not find compatible versions for pod "AUIAICal
ios