Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

Mochi at a true 60 fps: frame caps 10 % short (an exact 1/60 s skipped every other frame on 60 Hz), resting Mochi at 60 too

Claudea1827f38679a
diff --git a/NotchBuddy/Sources/App/BotCanvasView.swift b/NotchBuddy/Sources/App/BotCanvasView.swift
index ee9b2e30..054b489a 100644
--- a/NotchBuddy/Sources/App/BotCanvasView.swift
+++ b/NotchBuddy/Sources/App/BotCanvasView.swift
@@ -16,10 +16,10 @@ struct BotCanvasView: View {
@StateObject private var engine = BotEngine()
var body: some View {
- // 60 fps open, 30 fps in the small resting island: the engine still moves one
- // 0.05 step per display frame (MochiFrameClock), so the motion is the same as at
- // the display rate, with half to a quarter of the drawing.
- TimelineView(.animation(minimumInterval: state.mode == .expanded ? 1.0 / 60.0 : 1.0 / 30.0,
+ // 60 fps, open or resting (30 looked choppy): every frame on a 60 Hz screen, one
+ // in two on ProMotion. The engine still moves one 0.05 step per display frame
+ // (MochiFrameClock), so the motion is the same at any drawing rate.
+ TimelineView(.animation(minimumInterval: MochiFrameClock.interval(fps: 60),
paused: state.mode == .hidden || paused)) { timeline in
// The Canvas must capture the frame's date: a closure that doesn't change from
// one tick to the next is not redrawn, and Mochi froze.
@@ -242,7 +242,7 @@ struct MiniBotCanvasView: View {
var body: some View {
// A 12–20 pt Mochi: 30 fps looks the same as the display rate and costs a quarter
// on ProMotion. Paused in island views that are not shown.
- TimelineView(.animation(minimumInterval: 1.0 / 30.0, paused: !viewActive)) { timeline in
+ TimelineView(.animation(minimumInterval: MochiFrameClock.interval(fps: 30), paused: !viewActive)) { timeline in
let frame = timeline.date // see BotCanvasView: redraw on every tick
Canvas { context, size in
_ = frame
@@ -294,6 +294,11 @@ enum MochiFrameClock {
return fpsCache.value
}
+ /// minimumInterval for a target rate, 10 % short: display frames come every 16.6 ms
+ /// with jitter, and an interval of exactly 1/60 s skipped every other one (30 fps on a
+ /// 60 Hz screen). 60 on a 60 Hz screen draws every frame; on ProMotion, one in two.
+ static func interval(fps: Double) -> TimeInterval { 0.9 / fps }
+
static func advance(_ engine: BotEngine) {
let now = CACurrentMediaTime()
let elapsed = min(1.0 / 15.0, max(0, now - engine.lastTime))
diff --git a/NotchBuddy/Sources/App/DesktopMochi.swift b/NotchBuddy/Sources/App/DesktopMochi.swift
index 88dfadb9..f9e66fc4 100644
--- a/NotchBuddy/Sources/App/DesktopMochi.swift
+++ b/NotchBuddy/Sources/App/DesktopMochi.swift
@@ -28,7 +28,7 @@ struct DesktopBotView: View {
var body: some View {
TimelineView(.animation(
- minimumInterval: viewState.isSleeping ? 1.0 / 10.0 : 1.0 / 30.0,
+ minimumInterval: viewState.isSleeping ? 0.9 / 10.0 : 0.9 / 30.0, // 10 % short: see MochiFrameClock.interval
paused: viewState.paused
)) { timeline in
Canvas { ctx, size in
diff --git a/NotchBuddy/Sources/App/IslandViewContent.swift b/NotchBuddy/Sources/App/IslandViewContent.swift
index ccf7f32a..b5049600 100644
--- a/NotchBuddy/Sources/App/IslandViewContent.swift
+++ b/NotchBuddy/Sources/App/IslandViewContent.swift
@@ -3859,7 +3859,7 @@ struct TickerShimmerText: View {
var body: some View {
// A 2.2 s sweep: 60 fps is as smooth as the display rate, and it stops when hidden.
- TimelineView(.animation(minimumInterval: 1.0 / 60.0, paused: paused || !viewActive)) { tl in
+ TimelineView(.animation(minimumInterval: 0.9 / 60.0, paused: paused || !viewActive)) { tl in
let t = tl.date.timeIntervalSinceReferenceDate
let p = CGFloat(t.truncatingRemainder(dividingBy: 2.2) / 2.2)
// phase sweeps -0.1 → 1.1 so white peak enters from left and exits right