UI: liquid opening, staggered content, answer wave, haptics, gaze, notch drop
- Opening: the notch spreads sideways then pours down with a slight overshoot; header and screen come out of a soft blur one after the other. - Chat: a purple→orange wave of bars instead of three dots while Claude answers. - Haptic tap (Force Touch trackpad) when the notch opens and on Allow/Deny. - Memoji turns its head toward the cursor clearly (slide, lean, slight shear). - A drop of the folded notch stretches toward the approaching cursor (within 130 pt), leaning to its side; its own ObservableObject so only the drop redraws at 30 Hz. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,11 @@ 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)
|
||||
@@ -128,11 +133,25 @@ struct IslandContainer: View {
|
||||
nw: state.notchWidth, nh: state.notchHeight)
|
||||
let cr = newMode == .expanded ? IslandConst.expandedCorner : IslandConst.roundedCorner
|
||||
let tr: CGFloat = 0
|
||||
withAnimation(anim) {
|
||||
islandWidth = w
|
||||
islandHeight = (newMode == .expanded && state.view.isTall) ? chatPromptHeight : h
|
||||
cornerRadius = cr
|
||||
islandTopRadius = tr
|
||||
let targetH = (newMode == .expanded && state.view.isTall) ? chatPromptHeight : h
|
||||
if shrinking {
|
||||
withAnimation(anim) {
|
||||
islandWidth = w
|
||||
islandHeight = targetH
|
||||
cornerRadius = cr
|
||||
islandTopRadius = tr
|
||||
}
|
||||
} else {
|
||||
// Liquid opening: the notch spreads sideways first and pours down a beat
|
||||
// later, both with a little overshoot.
|
||||
withAnimation(.spring(response: 0.42, dampingFraction: 0.66)) {
|
||||
islandWidth = w
|
||||
cornerRadius = cr
|
||||
islandTopRadius = tr
|
||||
}
|
||||
withAnimation(.spring(response: 0.52, dampingFraction: 0.7).delay(0.05)) {
|
||||
islandHeight = targetH
|
||||
}
|
||||
}
|
||||
}
|
||||
.onChange(of: state.view) { _, newView in
|
||||
@@ -489,6 +508,8 @@ struct CountdownBar: View {
|
||||
|
||||
struct IslandContentView: View {
|
||||
@ObservedObject var state: AppState
|
||||
/// Header and screen come out of a soft blur one after the other on every opening.
|
||||
@State private var shown = false
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
@@ -496,6 +517,10 @@ struct IslandContentView: View {
|
||||
.frame(height: 34)
|
||||
.opacity(state.view == .confused ? 0 : 1)
|
||||
.animation(.easeInOut(duration: 0.2), value: state.view == .confused)
|
||||
.opacity(shown ? 1 : 0)
|
||||
.offset(y: shown ? 0 : -6)
|
||||
.blur(radius: shown ? 0 : 5)
|
||||
.animation(.spring(response: 0.38, dampingFraction: 0.8).delay(0.08), value: shown)
|
||||
|
||||
ZStack {
|
||||
// Only the visible screen is built (plus the chat, to keep its draft and
|
||||
@@ -522,10 +547,41 @@ struct IslandContentView: View {
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.padding(.horizontal, 10)
|
||||
.opacity(shown ? 1 : 0)
|
||||
.offset(y: shown ? 0 : 10)
|
||||
.blur(radius: shown ? 0 : 6)
|
||||
.animation(.spring(response: 0.45, dampingFraction: 0.82).delay(0.16), value: shown)
|
||||
}
|
||||
.padding(.top, 8)
|
||||
.padding(.bottom, 10)
|
||||
.foregroundColor(Color(hex: "#F5F6F8"))
|
||||
.onAppear { shown = true }
|
||||
.onDisappear { shown = false }
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Drop under the folded notch
|
||||
|
||||
/// 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 {
|
||||
@ObservedObject private var near = NotchProximity.shared
|
||||
let islandW: CGFloat
|
||||
let islandH: CGFloat
|
||||
|
||||
var body: 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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user