Notch: breathe toward the cursor instead of a separate drop

The detached black ellipse looked bad. The folded notch itself now grows slightly down
and sideways from its top edge as the cursor approaches, with a faint purple rim glow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maksarsanjeev
2026-10-10 02:11:07 +03:00
parent ecc68a1047
commit 2f1c82dc05
+10 -23
View File
@@ -12,6 +12,7 @@ struct IslandRootView: View {
Color.clear
.frame(maxWidth: .infinity, maxHeight: .infinity)
IslandContainer(state: state)
.modifier(NotchBreath())
.frame(maxWidth: .infinity, alignment: .center)
}
.ignoresSafeArea()
@@ -49,11 +50,6 @@ struct IslandContainer: View {
let greetingActive = state.mode == .expanded && state.view == .greeting
return ZStack(alignment: .topLeading) {
// Folded notch: a drop of the notch stretches toward the approaching cursor.
if state.mode != .expanded {
NotchDrop(islandW: islandWidth, islandH: islandHeight)
}
// Black island shape
IslandShape(width: islandWidth, height: islandHeight,
cornerRadius: cornerRadius, topRadius: islandTopRadius)
@@ -560,28 +556,19 @@ struct IslandContentView: View {
}
}
// MARK: - Drop under the folded notch
// MARK: - Folded notch reacts to the approaching cursor
/// A drop of the notch that stretches toward the cursor as it approaches (proximity 0…1):
/// tells you the notch will open, and leans to the side the cursor comes from.
struct NotchDrop: View {
/// The folded notch "breathes in" toward the cursor (proximity 0…1): grows a little
/// down and sideways from the top edge, with a faint glow along its rim.
struct NotchBreath: ViewModifier {
@ObservedObject private var near = NotchProximity.shared
let islandW: CGFloat
let islandH: CGFloat
var body: some View {
func body(content: Content) -> some View {
let p = near.value
let lean = max(-1, min(1, (AppState.shared.mousePosition.x - (NSScreen.main?.frame.width ?? 0) / 2) / 200))
let w = islandW * (0.34 + 0.22 * p)
let h = 4 + 16 * p
Ellipse()
.fill(Color.black)
.frame(width: w, height: h * 2)
.shadow(color: Color(hex: "#A78BFA").opacity(0.35 * p), radius: 8 * p)
.position(x: islandW / 2 + lean * 14 * p, y: islandH + h * 0.3)
.opacity(p > 0.01 ? 1 : 0)
.animation(.spring(response: 0.3, dampingFraction: 0.62), value: p)
.allowsHitTesting(false)
content
.scaleEffect(x: 1 + 0.035 * p, y: 1 + 0.16 * p, anchor: .top)
.shadow(color: Color(hex: "#A78BFA").opacity(0.28 * p), radius: 7 * p, y: 2 * p)
.animation(.spring(response: 0.32, dampingFraction: 0.7), value: p)
}
}