-
Notifications
You must be signed in to change notification settings - Fork 3
/
ContentView.swift
35 lines (31 loc) · 928 Bytes
/
ContentView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// ContentView.swift
// P06D Animations
//
// Created by Julian Moorhouse on 12/12/2020.
// Copyright © 2020 Mindwarp Consultancy Ltd. All rights reserved.
//
import SwiftUI
struct ContentView: View {
@State private var enabled = false
var body: some View {
Button("Tap me") {
self.enabled.toggle()
}
.frame(width: 200, height: 200)
.background(enabled ? Color.blue : Color.red)
//.animation(.default)
.animation(nil)
.foregroundColor(.white)
// Ordering matters
.clipShape(RoundedRectangle(cornerRadius: enabled ? 60 : 0))
//.animation(.default)
//.clipShape(RoundedRectangle(cornerRadius: enabled ? 60 : 0))
.animation(.interpolatingSpring(stiffness: 10, damping: 1))
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}