This commit is contained in:
Francesco 2025-06-01 21:01:13 +02:00
parent ec380f06d9
commit e05991a631
4 changed files with 43 additions and 22 deletions

View file

@ -19,7 +19,7 @@ struct ScrollViewBottomPadding: ViewModifier {
extension View {
func shimmering() -> some View {
self.modifier(Shimmer())
modifier(Shimmer())
}
func scrollViewBottomPadding() -> some View {

View file

@ -1921,9 +1921,7 @@ class CustomMediaPlayerViewController: UIViewController, UIGestureRecognizerDele
return (self.episodeNumber == self.totalEpisodes) ? "COMPLETED" : "CURRENT"
}
}()
client.updateAnimeProgress(
animeId: self.aniListID,
episodeNumber: self.episodeNumber,

View file

@ -12,23 +12,45 @@ struct Shimmer: ViewModifier {
func body(content: Content) -> some View {
content
.overlay(
Rectangle()
.fill(
LinearGradient(
gradient: Gradient(colors: [Color.clear, Color.white.opacity(0.4), Color.clear]),
startPoint: .top,
endPoint: .bottom
)
)
.rotationEffect(.degrees(30))
.offset(x: self.phase * 350)
)
.mask(content)
.modifier(AnimatedMask(phase: phase).animation(
Animation.linear(duration: 1.5)
.repeatForever(autoreverses: false)
))
.onAppear {
withAnimation(.linear(duration: 1.5).repeatForever(autoreverses: false)) {
self.phase = 1
}
phase = 0.8
}
}
struct AnimatedMask: AnimatableModifier {
var phase: CGFloat = 0
var animatableData: CGFloat {
get { phase }
set { phase = newValue }
}
func body(content: Content) -> some View {
content
.overlay(
GeometryReader { geo in
Rectangle()
.fill(
LinearGradient(
gradient: Gradient(stops: [
.init(color: .clear, location: phase - 0.3),
.init(color: .white.opacity(0.5), location: phase),
.init(color: .clear, location: phase + 0.3)
]),
startPoint: .leading,
endPoint: .trailing
)
)
.rotationEffect(.degrees(30))
.offset(x: -geo.size.width)
.offset(x: geo.size.width * 2 * phase)
}
)
.mask(content)
}
}
}

View file

@ -11,7 +11,7 @@ struct HomeSkeletonCell: View {
let cellWidth: CGFloat
var body: some View {
VStack {
ZStack(alignment: .bottom) {
RoundedRectangle(cornerRadius: 10)
.fill(Color.gray.opacity(0.3))
.frame(width: cellWidth, height: cellWidth * 1.5)
@ -31,11 +31,12 @@ struct SearchSkeletonCell: View {
let cellWidth: CGFloat
var body: some View {
VStack(alignment: .leading, spacing: 8) {
ZStack(alignment: .bottom) {
RoundedRectangle(cornerRadius: 10)
.fill(Color.gray.opacity(0.3))
.frame(width: cellWidth, height: cellWidth * 1.5)
.shimmering()
RoundedRectangle(cornerRadius: 5)
.fill(Color.gray.opacity(0.3))
.frame(width: cellWidth, height: 20)