Improve animations and resizing again. Add option for animation speed.

This commit is contained in:
2026-03-13 00:14:00 +11:00
parent 256998eb9f
commit e4719cb9f4
6 changed files with 135 additions and 9 deletions

View File

@@ -227,6 +227,7 @@ struct AnimationSettingsView: View {
@AppStorage(NotchSettings.Keys.closeSpringDamping) private var closeDamping = NotchSettings.Defaults.closeSpringDamping
@AppStorage(NotchSettings.Keys.hoverSpringResponse) private var hoverResponse = NotchSettings.Defaults.hoverSpringResponse
@AppStorage(NotchSettings.Keys.hoverSpringDamping) private var hoverDamping = NotchSettings.Defaults.hoverSpringDamping
@AppStorage(NotchSettings.Keys.resizeAnimationDuration) private var resizeDuration = NotchSettings.Defaults.resizeAnimationDuration
var body: some View {
Form {
@@ -239,6 +240,9 @@ struct AnimationSettingsView: View {
Section("Hover Animation") {
springControls(response: $hoverResponse, damping: $hoverDamping)
}
Section("Resize Animation") {
durationControl(duration: $resizeDuration)
}
Section {
Button("Reset to Defaults") {
openResponse = NotchSettings.Defaults.openSpringResponse
@@ -247,6 +251,7 @@ struct AnimationSettingsView: View {
closeDamping = NotchSettings.Defaults.closeSpringDamping
hoverResponse = NotchSettings.Defaults.hoverSpringResponse
hoverDamping = NotchSettings.Defaults.hoverSpringDamping
resizeDuration = NotchSettings.Defaults.resizeAnimationDuration
}
}
}
@@ -266,6 +271,15 @@ struct AnimationSettingsView: View {
Text(String(format: "%.2f", damping.wrappedValue)).monospacedDigit().frame(width: 50)
}
}
@ViewBuilder
private func durationControl(duration: Binding<Double>) -> some View {
HStack {
Text("Duration")
Slider(value: duration, in: 0.05...1.5, step: 0.01)
Text(String(format: "%.2fs", duration.wrappedValue)).monospacedDigit().frame(width: 56)
}
}
}
// MARK: - Terminal