this is ebtter?

This commit is contained in:
Francesco 2025-06-06 14:33:51 +02:00
parent 6488c345c8
commit a834e41570
2 changed files with 20 additions and 13 deletions

View file

@ -31,7 +31,7 @@
- [x] Streams support (Jellyfin/Plex like servers) - [x] Streams support (Jellyfin/Plex like servers)
- [x] External Metadata providers (TMDB, AniList) - [x] External Metadata providers (TMDB, AniList)
- [x] Background playback and Picture-in-Picture (PiP) support - [x] Background playback and Picture-in-Picture (PiP) support
- [x] External media player support (VLC, Infuse, Outplayer, nPlayer, SenPlayer, IINA) - [x] External media player support (VLC, Infuse, Outplayer, nPlayer, SenPlayer, IINA, TracyPlayer)
## Installation ## Installation

View file

@ -8,16 +8,18 @@
import SwiftUI import SwiftUI
struct Shimmer: ViewModifier { struct Shimmer: ViewModifier {
@State private var phase: CGFloat = 0 @State private var phase: CGFloat = -1
func body(content: Content) -> some View { func body(content: Content) -> some View {
content content
.modifier(AnimatedMask(phase: phase).animation( .modifier(AnimatedMask(phase: phase)
Animation.linear(duration: 1.5) .animation(
.repeatForever(autoreverses: false) Animation.linear(duration: 1.2)
)) .repeatForever(autoreverses: false)
)
)
.onAppear { .onAppear {
phase = 0.8 phase = 1.5
} }
} }
@ -33,21 +35,26 @@ struct Shimmer: ViewModifier {
content content
.overlay( .overlay(
GeometryReader { geo in GeometryReader { geo in
let width = geo.size.width
let shimmerStart = phase - 0.25
let shimmerEnd = phase + 0.25
Rectangle() Rectangle()
.fill( .fill(
LinearGradient( LinearGradient(
gradient: Gradient(stops: [ gradient: Gradient(stops: [
.init(color: .clear, location: phase - 0.3), .init(color: Color.white.opacity(0.05), location: shimmerStart - 0.15),
.init(color: .white.opacity(0.5), location: phase), .init(color: Color.white.opacity(0.25), location: shimmerStart),
.init(color: .clear, location: phase + 0.3) .init(color: Color.white.opacity(0.85), location: phase),
.init(color: Color.white.opacity(0.25), location: shimmerEnd),
.init(color: Color.white.opacity(0.05), location: shimmerEnd + 0.15)
]), ]),
startPoint: .leading, startPoint: .leading,
endPoint: .trailing endPoint: .trailing
) )
) )
.rotationEffect(.degrees(30)) .blur(radius: 8)
.offset(x: -geo.size.width) .rotationEffect(.degrees(20))
.offset(x: geo.size.width * 2 * phase) .offset(x: -width * 0.7 + width * 2 * phase)
} }
) )
.mask(content) .mask(content)