-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathSpotifyNowPlaying.swift
57 lines (52 loc) · 2.08 KB
/
SpotifyNowPlaying.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
50
51
52
53
54
55
56
57
//
// SpotifyNowPlaying.swift
// Spotify Now Playing Animation
// SwiftUI Animation Challenge 1
//
// ANIMATION AND MEANING: RA visual representation of audio signals/ now playing
import SwiftUI
struct SpotifyNowPlaying: View {
@State private var trim = 0.0
var body: some View {
VStack(alignment: .leading) {
Text("Now playing")
HStack {
RoundedRectangle(cornerRadius: 3)
.fill(.indigo.gradient)
.frame(width: 12, height: 64)
.scaleEffect(y: trim, anchor: .bottom)
//.scaleEffect(y: drawingHeight ? 0.8 : 1, anchor: .bottom)
.animation(.default.repeatForever(), value: trim)
RoundedRectangle(cornerRadius: 3)
.fill(.indigo.gradient)
.frame(width: 12, height: 64)
.scaleEffect(y: trim, anchor: .bottom)
.animation(.easeOut.repeatForever(), value: trim)
RoundedRectangle(cornerRadius: 3)
.fill(.indigo.gradient)
.frame(width: 12, height: 64)
.scaleEffect(y: trim, anchor: .bottom)
.animation(.easeIn.repeatForever(), value: trim)
RoundedRectangle(cornerRadius: 3)
.fill(.indigo.gradient)
.frame(width: 12, height: 64)
.scaleEffect(y: trim, anchor: .bottom)
.animation(.easeOut.repeatForever(), value: trim)
RoundedRectangle(cornerRadius: 3)
.fill(.indigo.gradient)
.frame(width: 12, height: 64)
.scaleEffect(y: trim, anchor: .bottom)
.animation(.easeInOut.repeatForever(), value: trim)
}
.onAppear{
trim = .random(in: 0.5..<1)
}
}
}
}
struct SpotifyNowPlaying_Previews: PreviewProvider {
static var previews: some View {
SpotifyNowPlaying()
.preferredColorScheme(.dark)
}
}