当前位置: 首页 > news >正文

SwiftUI的转场动画

SwiftUI的转场动画

记录一下SwiftUI中的一些弹窗动画


import SwiftUIstruct TransitionBootCamp: View {@State var showView = falselet screenWidth = UIScreen.main.bounds.widthlet screenHeight = UIScreen.main.bounds.heightvar body: some View {ZStack(alignment: .bottom, content: {VStack{Button("Button") {showView.toggle()}Spacer()}if showView {RoundedRectangle(cornerRadius: 25.0).ignoresSafeArea().frame(height: screenHeight * 0.5)/// 从底部升上去.transition(AnyTransition.move(edge: .bottom)).animation(.bouncy)/// 透明度渐变出现
//                    .transition(AnyTransition.opacity.animation(.default))/// 比例出现
//                    .transition(AnyTransition.scale.animation(.default))/// 控制出来和结束方向 左进下出
//                    .transition(.asymmetric(insertion: .move(edge: .leading), removal: .move(edge: .bottom)))
//                    .animation(.easeInOut)}})}
}#Preview {TransitionBootCamp()
}
http://www.lryc.cn/news/316793.html

相关文章:

  • Trust Region Policy Optimization (TRPO)
  • 消息服务--Kafka的简介和使用
  • 【c++11线程库的使用】
  • 无限debugger的几种处理方式
  • 数据库基础理论知识
  • 华为OD机试真题-模拟目录管理-2024年OD统一考试(C卷)
  • yield代码解释
  • C#四部曲(知识补充)
  • Vue中的数据交互有几种方式
  • 2.MySQL中的数据类型
  • 身份证查询真伪-三要素查验-ios身份证实名认证接口调用
  • @EnableWebMvc介绍和使用详细demo
  • VC-旅游系统-213-(代码+说明)
  • 重学SpringBoot3-ErrorMvcAutoConfiguration类
  • 剑指offer面试题34 丑数
  • C++ std::list的merge()使用与分析
  • Quartz的分布式功能化设计
  • Caffeine缓存
  • AI辅助研发正在成为造福人类的新生科技力量
  • 程序分享--排序算法--归并排序
  • pg数据库和mysql区别
  • Jetpack Compose 动画正式开始学习
  • iOS 17.4报错: libopencore-amrnb.a[arm64]
  • 鼓楼夜市管理wpf+sqlserver
  • 【五、接口自动化测试】5分钟掌握python + requests接口测试
  • 双边市场的基本理论
  • R统计学2 - 数据分析入门问题21-40
  • 蓝桥杯2023年-买瓜(dfs,类型转换同样耗时)
  • 生成式人工智能服务安全基本要求实务解析
  • nginx详解,配置http,https,负载均衡,反向代理,SMTP 代理步骤说明