Skip to content

perf(app): the mascots' eyes move in moments, not forever - #163

Merged
httpsphl merged 1 commit into
mainfrom
perf/eye-moments
Oct 4, 2026
Merged

httpsphl merged 1 commit into
mainfrom
perf/eye-moments

Conversation

@httpsphl

@httpsphl httpsphl commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Follow-up of #162, as the owner chose: the eyes blink and look around in random moments instead of running an animation forever.

  • features/bots/eyeMoments.ts, started once in main.tsx: every 2 s it picks which awake mascots on screen blink (each about every 7 s, up to 0.6 s apart, so they do not blink together; 260 ms blink, 800 ms droop for tired lids), and every 9-16 s one idle mascot glances around (4.4 s). Nothing while the window is hidden, unfocused (perf(app): mascots stand still while another app has the focus #162's data-blurred), or with less motion.
  • mascot.css: blink, glance and tired droop only run while data-blink/data-look is on the mascot; keyframes rescaled to those short moments. The glance toward another bot (data-glance) is unchanged.

Measured (dev app over CDP, same session, flame running in both):

eyes WebView CPU
infinite (before) 1.35, 1.49 cores
moments (this PR) 1.19, 1.01 cores
moments, flame paused 0.15 cores

What is left is the flame's continuous morph, which keeps frames coming at the screen's rate.

Test plan

  • pnpm check (new eyeMoments.test.ts: blink and release, sleeping/still never, glance pacing, nothing while unfocused)
  • Measured A/B in the dev app (table above)
  • Installed app: mascots blink naturally and quickly, now and then one looks around

Blinking and glancing ran as infinite animations, which keep the WebView
drawing every frame. A scheduler now picks, every two seconds, which
mascots on screen blink (each about every 7 s, a little apart) and now
and then lets one idle mascot look around; in between the eyes stand
still. Measured in the dev app with the flame running: 1.0-1.2 cores
instead of 1.35-1.5.
@httpsphl
httpsphl enabled auto-merge October 4, 2026 19:24
@httpsphl
httpsphl merged commit 5f8f3b3 into main Oct 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant