-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathRecordingAnimation.swift
49 lines (45 loc) · 1.56 KB
/
RecordingAnimation.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// Recording.swift
// PurposefulSwiftUIAnimations
//
// ANIMATION AND MEANING - Recording, Listening: Representation of activities
//
import SwiftUI
struct Recording: View {
@State private var recording = 0.0
var body: some View {
ZStack {
Circle()
.stroke(lineWidth: 1)
.fill(Color(.systemGray6).gradient)
.frame(width: 64, height: 64)
.scaleEffect(recording)
.animation(.easeOut(duration: 0.5).delay(0.3).repeatForever(autoreverses: true), value: recording)
Circle()
.stroke(lineWidth: 1)
.fill(Color(.systemGray6).gradient)
.frame(width: 64, height: 64)
.scaleEffect(recording)
.animation(.easeOut(duration: 0.5).delay(1).repeatForever(autoreverses: false), value: recording)
Circle()
.fill(Color(.systemGray6).gradient)
.frame(width: 48, height: 48)
.scaleEffect(recording)
.animation(.easeInOut(duration: 0.5).delay(0.5).repeatForever(autoreverses: false), value: recording)
Circle()
.fill(.red.gradient)
.frame(width: 64, height: 64)
Image(systemName: "mic.fill")
.font(.largeTitle)
}
.onAppear {
recording = .random(in: 1..<5)
}
}
}
struct Recording_Previews: PreviewProvider {
static var previews: some View {
Recording()
.preferredColorScheme(.dark)
}
}