Did something really awful to make bad effects
TODO: Overhaul all of this
This commit is contained in:
parent
0798bb7141
commit
9da269a6ab
@ -15,7 +15,8 @@ struct ItemHeaderView: View {
|
|||||||
.init(color: .clear, location: 0),
|
.init(color: .clear, location: 0),
|
||||||
.init(color: .black, location: 0.3),
|
.init(color: .black, location: 0.3),
|
||||||
.init(color: .black, location: 0.7),
|
.init(color: .black, location: 0.7),
|
||||||
.init(color: .clear, location: 1)
|
|
||||||
|
.init(color: .clear, location: 1)
|
||||||
]), startPoint: .bottom, endPoint: .top)
|
]), startPoint: .bottom, endPoint: .top)
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@ -24,7 +25,7 @@ struct ItemHeaderView: View {
|
|||||||
.hideCaption()
|
.hideCaption()
|
||||||
.setCornerRadius(0)
|
.setCornerRadius(0)
|
||||||
.mask(overlayGradient)
|
.mask(overlayGradient)
|
||||||
.padding(.top, 50)
|
// .padding(.top, 50)
|
||||||
.background {
|
.background {
|
||||||
LibraryIconView(library: item, imageType: "Backdrop", contentMode: .fill)
|
LibraryIconView(library: item, imageType: "Backdrop", contentMode: .fill)
|
||||||
.hideCaption()
|
.hideCaption()
|
||||||
@ -33,17 +34,18 @@ struct ItemHeaderView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
LibraryIconView(library: item, imageType: "Logo", width: 150)
|
LibraryIconView(library: item, imageType: "Logo", width: 200, height: 100, placeHolder: AnyView(Text(item.name ?? "Unknown").font(.title).bold().truncationMode(.middle)))
|
||||||
.hideCaption()
|
.hideCaption()
|
||||||
.setCornerRadius(0)
|
.setCornerRadius(0)
|
||||||
.shadow(radius: 10)
|
.shadow(radius: 10)
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
.frame(alignment: .leading)
|
||||||
.padding(.leading)
|
.padding(.leading)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#Preview {
|
// #Preview {
|
||||||
ItemHeaderView(item: BaseItemDto())
|
// ItemHeaderView(item: BaseItemDto())
|
||||||
}
|
// }
|
||||||
|
@ -15,21 +15,56 @@ struct ItemMovieView: View {
|
|||||||
@State var item: BaseItemDto
|
@State var item: BaseItemDto
|
||||||
@State var loading: Bool = true
|
@State var loading: Bool = true
|
||||||
|
|
||||||
|
@State var navigationTitle: String = ""
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
|
// ItemHeaderView(item: item)
|
||||||
|
// .scrollTransition {content, phase in
|
||||||
|
// content
|
||||||
|
// .scaleEffect(phase.isIdentity ? 1 : 2)
|
||||||
|
// .opacity(phase.isIdentity ? 1 : 0.1)
|
||||||
|
// .blur(radius: phase.isIdentity ? 0 : 50)
|
||||||
|
// }
|
||||||
ItemHeaderView(item: item)
|
ItemHeaderView(item: item)
|
||||||
|
.opacity(0) // this is the jankiest thing in existence
|
||||||
|
.background {
|
||||||
|
GeometryReader {geo in
|
||||||
|
ItemHeaderView(item: item)
|
||||||
|
.onChange(of: geo.frame(in: .global).minY) {
|
||||||
|
navigationTitle = geo.frame(in: .global).minY < 0 ? item.name ?? "Unknown" : ""
|
||||||
|
}
|
||||||
|
.scaleEffect(1 + (geo.frame(in: .global).minY > 0 ? geo.frame(in: .global).minY * 0.001 : 0))
|
||||||
|
.offset(y: 1 + (geo.frame(in: .global).minY > 0 ? geo.frame(in: .global).minY * 0.001 : 0))
|
||||||
|
.scrollTransition {content, phase in
|
||||||
|
content
|
||||||
|
.scaleEffect(phase.isIdentity ? 1 : 2)
|
||||||
|
.opacity(phase.isIdentity ? 1 : 0.1)
|
||||||
|
.blur(radius: phase.isIdentity ? 0 : 50)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Text(item.taglines?[0] ?? "Unknown")
|
VStack {
|
||||||
.font(.headline)
|
Text(item.taglines?[0] ?? "Unknown")
|
||||||
.padding(.top, 20)
|
.font(.headline)
|
||||||
|
.padding(.top, 20)
|
||||||
|
|
||||||
Text(item.overview ?? "Unknown")
|
Text(item.overview ?? "Unknown")
|
||||||
.padding()
|
.padding()
|
||||||
|
Text(item.overview ?? "Unknown")
|
||||||
|
.padding()
|
||||||
|
Text(item.overview ?? "Unknown")
|
||||||
|
.padding()
|
||||||
|
Text(item.overview ?? "Unknown")
|
||||||
|
.padding()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.redacted(reason: loading ? .placeholder : [])
|
.redacted(reason: loading ? .placeholder : [])
|
||||||
.ignoresSafeArea(edges: .top)
|
.ignoresSafeArea(edges: .top)
|
||||||
|
.scrollIndicators(.hidden)
|
||||||
.toolbarRole(.editor)
|
.toolbarRole(.editor)
|
||||||
.navigationTitle(item.name ?? "Unknown")
|
.navigationTitle(navigationTitle)
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
Task {
|
Task {
|
||||||
|
@ -22,6 +22,8 @@ struct LibraryIconView: View {
|
|||||||
@State var imageUrl: URL?
|
@State var imageUrl: URL?
|
||||||
@State var contentMode: ContentMode = .fit
|
@State var contentMode: ContentMode = .fit
|
||||||
|
|
||||||
|
@State var placeHolder: AnyView?
|
||||||
|
|
||||||
var shouldShowCaption: Bool = true
|
var shouldShowCaption: Bool = true
|
||||||
var imageCornerRadius: CGFloat = 5
|
var imageCornerRadius: CGFloat = 5
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@ -33,8 +35,12 @@ struct LibraryIconView: View {
|
|||||||
} else if state.error != nil {
|
} else if state.error != nil {
|
||||||
Color.red
|
Color.red
|
||||||
} else {
|
} else {
|
||||||
Image(uiImage: blurHashImage)
|
if let content = placeHolder {
|
||||||
.resizable()
|
content
|
||||||
|
} else {
|
||||||
|
Image(uiImage: blurHashImage)
|
||||||
|
.resizable()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.aspectRatio(contentMode: contentMode)
|
.aspectRatio(contentMode: contentMode)
|
||||||
|
Loading…
Reference in New Issue
Block a user