欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

swiftUI 旋转缩放动画

程序员文章站 2022-03-16 15:13:23
...

swiftUI 旋转缩放动画

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()
        }
    }

 

相关标签: # swiftUI