实战需求
SwiftUI 动画之Circle Animation 移动、旋转、显示、消失和放大联合动画 (教程含源码)
本文价值与收获
看完本文后,您将能够作出下面的界面
看完本文您将掌握的技能
//从顶向下线性过渡
LinearGradient(gradient: Gradient(colors:[.green, .white]), startPoint: .top, endPoint: .bottom))//垂直偏移
.offset(y: moveInOut ? -60 : 0)//设置透明度
.opacity(0.5)旋转60度
.rotationEffect(.degrees(60))设置重复播放
.animation(Animation.easeInOut.repeatForever(autoreverses: true).speed(1/8))
基础知识
LinearGradient
线性渐变。