当前位置 : 主页 > 编程语言 > java >

swiftUI 旋转缩放动画

来源:互联网 收集:自由互联 发布时间:2023-03-22
code // // ContentView.swift // learn_swiftUi // // Created by liuan on 2020/5/14. // Copyright © 2020 liuan. All rights reserved. // import SwiftUI struct ContentView: View { @State private var showDetail = false var body: some View { But

swiftUI 旋转缩放动画_swift

code

// // ContentView.swift // learn_swiftUi // // Created by liuan on 2020/5/14. // Copyright © 2020 liuan. All rights reserved. // import SwiftUI struct ContentView: View { @State private var showDetail = false var body: some View { Button(action: { withAnimation{ self.showDetail = !self.showDetail } }) { Image(systemName:"chevron.right.circle") .imageScale(.large) .rotationEffect(.degrees(self.showDetail ? 90 : 0)) .scaleEffect(showDetail ? 1.5:1) .padding() }} } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }

 

网友评论