mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-03-18 15:34:01 +01:00
Update Blur and Tranition
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// ContentView.swift
|
||||
// SwiftUI-BasicAnimation
|
||||
//
|
||||
// Created by Meng To on 2019-06-06.
|
||||
// Copyright © 2019 Meng To. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ContentView: View {
|
||||
@State var show = false
|
||||
|
||||
var body: some View {
|
||||
|
||||
VStack {
|
||||
Text("Learning SwiftUI")
|
||||
.font(.largeTitle)
|
||||
.fontWeight(.semibold)
|
||||
.color(.black)
|
||||
.padding(4)
|
||||
.animation(.basic(duration: 0.3, curve: .easeOut))
|
||||
|
||||
Image("ui")
|
||||
.frame(width: show ? 414 : 300, height: show ? 600 : 300)
|
||||
.clipped()
|
||||
.cornerRadius(show ? 0 : 30)
|
||||
.shadow(radius: 30)
|
||||
.blur(radius: show ? 0 : 30)
|
||||
.animation(.spring())
|
||||
.aspectRatio(contentMode: .fill)
|
||||
|
||||
Text("A course focused on UI")
|
||||
.font(.subheadline)
|
||||
.fontWeight(.regular)
|
||||
.color(.gray)
|
||||
.padding(4)
|
||||
.animation(.basic(duration: 0.4, curve: .easeIn))
|
||||
|
||||
Button(action: {
|
||||
withAnimation {
|
||||
self.show.toggle()
|
||||
}
|
||||
}) {
|
||||
Text("Animate")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ContentView()
|
||||
.colorScheme(.dark)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user