mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Add Parallax Effect Media Player
This commit is contained in:
parent
04f4cdc737
commit
00d4ba0534
5 changed files with 21 additions and 2 deletions
|
|
@ -3283,6 +3283,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Applies the notch-style parallax effect to the lock screen media widget album art." : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Are you sure you want to delete \"%@\"?" : {
|
"Are you sure you want to delete \"%@\"?" : {
|
||||||
"comment" : "A confirmation prompt asking the user to confirm the deletion of a custom idle animation. The placeholder text inside the quotation marks should be replaced with the name of the animation.",
|
"comment" : "A confirmation prompt asking the user to confirm the deletion of a custom idle animation. The placeholder text inside the quotation marks should be replaced with the name of the animation.",
|
||||||
|
|
@ -10999,6 +11002,9 @@
|
||||||
"Lock Screen Liquid Glass" : {
|
"Lock Screen Liquid Glass" : {
|
||||||
"comment" : "The title of the music panel on the lock screen.",
|
"comment" : "The title of the music panel on the lock screen.",
|
||||||
"isCommentAutoGenerated" : true
|
"isCommentAutoGenerated" : true
|
||||||
|
},
|
||||||
|
"Lock Screen Media" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Lock screen panel preview" : {
|
"Lock screen panel preview" : {
|
||||||
"comment" : "A description of the content displayed in the lock screen panel.",
|
"comment" : "A description of the content displayed in the lock screen panel.",
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ struct LockScreenMusicPanel: View {
|
||||||
@Default(.musicControlSlots) private var slotConfig
|
@Default(.musicControlSlots) private var slotConfig
|
||||||
@Default(.musicSkipBehavior) private var musicSkipBehavior
|
@Default(.musicSkipBehavior) private var musicSkipBehavior
|
||||||
@Default(.enableLyrics) private var enableLyrics
|
@Default(.enableLyrics) private var enableLyrics
|
||||||
|
@Default(.lockScreenMusicAlbumParallaxEnabled) private var lockScreenParallaxEnabled
|
||||||
|
|
||||||
init(animator: LockScreenPanelAnimator) {
|
init(animator: LockScreenPanelAnimator) {
|
||||||
_animator = ObservedObject(wrappedValue: animator)
|
_animator = ObservedObject(wrappedValue: animator)
|
||||||
|
|
@ -238,6 +239,7 @@ struct LockScreenMusicPanel: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.albumArtFlip(angle: musicManager.flipAngle)
|
.albumArtFlip(angle: musicManager.flipAngle)
|
||||||
|
.modifier(ParallaxMotionModifier(magnitude: 12, enableOverride: lockScreenParallaxEnabled))
|
||||||
.frame(width: size, height: size)
|
.frame(width: size, height: size)
|
||||||
.background(albumArtBackground(cornerRadius: cornerRadius))
|
.background(albumArtBackground(cornerRadius: cornerRadius))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1849,6 +1849,7 @@ struct Media: View {
|
||||||
@Default(.enableLockScreenMediaWidget) private var enableLockScreenMediaWidget
|
@Default(.enableLockScreenMediaWidget) private var enableLockScreenMediaWidget
|
||||||
@Default(.showSneakPeekOnTrackChange) private var showSneakPeekOnTrackChange
|
@Default(.showSneakPeekOnTrackChange) private var showSneakPeekOnTrackChange
|
||||||
@Default(.lockScreenGlassStyle) private var lockScreenGlassStyle
|
@Default(.lockScreenGlassStyle) private var lockScreenGlassStyle
|
||||||
|
@Default(.lockScreenMusicAlbumParallaxEnabled) private var lockScreenMusicAlbumParallaxEnabled
|
||||||
|
|
||||||
private func highlightID(_ title: String) -> String {
|
private func highlightID(_ title: String) -> String {
|
||||||
SettingsTab.media.highlightID(for: title)
|
SettingsTab.media.highlightID(for: title)
|
||||||
|
|
@ -1905,6 +1906,14 @@ struct Media: View {
|
||||||
} header: {
|
} header: {
|
||||||
Text("Media controls")
|
Text("Media controls")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Section(header: Text("Lock Screen Media")) {
|
||||||
|
Defaults.Toggle("Enable album art parallax", key: .lockScreenMusicAlbumParallaxEnabled)
|
||||||
|
.settingsHighlight(id: highlightID("Enable album art parallax"))
|
||||||
|
Text("Applies the notch-style parallax effect to the lock screen media widget album art.")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
}
|
||||||
if musicControlWindowEnabled {
|
if musicControlWindowEnabled {
|
||||||
Section {
|
Section {
|
||||||
Picker("Skip buttons", selection: $musicSkipBehavior) {
|
Picker("Skip buttons", selection: $musicSkipBehavior) {
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,14 @@ import Defaults
|
||||||
|
|
||||||
struct ParallaxMotionModifier: ViewModifier {
|
struct ParallaxMotionModifier: ViewModifier {
|
||||||
var magnitude: Double
|
var magnitude: Double
|
||||||
|
var enableOverride: Bool?
|
||||||
|
|
||||||
@Default(.enableParallaxEffect) var enableParallaxEffect
|
@Default(.enableParallaxEffect) var enableParallaxEffect
|
||||||
@State private var offset: CGSize = .zero
|
@State private var offset: CGSize = .zero
|
||||||
@State private var isHovering = false
|
@State private var isHovering = false
|
||||||
|
|
||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
if !enableParallaxEffect {
|
if !(enableOverride ?? enableParallaxEffect) {
|
||||||
content
|
content
|
||||||
} else {
|
} else {
|
||||||
content
|
content
|
||||||
|
|
@ -65,6 +66,6 @@ struct ParallaxMotionModifier: ViewModifier {
|
||||||
|
|
||||||
extension View {
|
extension View {
|
||||||
func parallax3D(magnitude: Double = 10) -> some View {
|
func parallax3D(magnitude: Double = 10) -> some View {
|
||||||
modifier(ParallaxMotionModifier(magnitude: magnitude))
|
modifier(ParallaxMotionModifier(magnitude: magnitude, enableOverride: nil))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -474,6 +474,7 @@ extension Defaults.Keys {
|
||||||
static let lockScreenWeatherProviderSource = Key<LockScreenWeatherProviderSource>("lockScreenWeatherProviderSource", default: .openMeteo)
|
static let lockScreenWeatherProviderSource = Key<LockScreenWeatherProviderSource>("lockScreenWeatherProviderSource", default: .openMeteo)
|
||||||
static let lockScreenWeatherVerticalOffset = Key<Double>("lockScreenWeatherVerticalOffset", default: 0)
|
static let lockScreenWeatherVerticalOffset = Key<Double>("lockScreenWeatherVerticalOffset", default: 0)
|
||||||
static let lockScreenMusicVerticalOffset = Key<Double>("lockScreenMusicVerticalOffset", default: 0)
|
static let lockScreenMusicVerticalOffset = Key<Double>("lockScreenMusicVerticalOffset", default: 0)
|
||||||
|
static let lockScreenMusicAlbumParallaxEnabled = Key<Bool>("lockScreenMusicAlbumParallaxEnabled", default: true)
|
||||||
static let lockScreenTimerVerticalOffset = Key<Double>("lockScreenTimerVerticalOffset", default: 0)
|
static let lockScreenTimerVerticalOffset = Key<Double>("lockScreenTimerVerticalOffset", default: 0)
|
||||||
static let lockScreenGlassStyle = Key<LockScreenGlassStyle>("lockScreenGlassStyle", default: .liquid)
|
static let lockScreenGlassStyle = Key<LockScreenGlassStyle>("lockScreenGlassStyle", default: .liquid)
|
||||||
static let lockScreenShowAppIcon = Key<Bool>("lockScreenShowAppIcon", default: false)
|
static let lockScreenShowAppIcon = Key<Bool>("lockScreenShowAppIcon", default: false)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue