Files
Akira ValadeandClaude Opus 5.5 2a22066a3e feat: smooth transitions for abrupt animation changes
- Pose blending between anims (render/blend.ts): the on-screen pose is lerped
  into the next anim, drawn live, only when the pose change is abrupt; fast and
  physics-driven anims (jumps, land, startle, happy...) opt out with ease: 0
- Left/right turns animate as a quick fake rotation (CSS scaleX + small hop)
- Follow: hysteresis on look up/down/sniff, no flip when the cursor is right above
- New `motion` config (blend multiplier, turnTime) + Leva "Transitions" folder

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 03:40:36 +01:00

1.7 KiB

Brain

brain/Brain.ts runs one task at a time; a task is a generator coroutine (Co, brain/co.ts) that receives dt on each next.

Priorities

auto 0 (idle, wander, explore, extra, sleep) < follow 1 < page 2 (reactions, goTo, eat, watch typing, purr) < user 3 (pet, squish, startle, wake, recover) < fall 4. A job only replaces a lower or equal priority one; non-air jobs requested mid-air are queued until landing. Cooldowns throttle startle / follow / eat / watch.

Sensing (each frame)

Falling → recover. Fast cursor close by → startle. Stroke level (hovering back and forth) > 1 → purr. Unclaimed seed → eat. Cursor recently moved within followRadius → follow. Otherwise choose() picks weighted by activity, explore and fatigue (grows with sleepiness).

Building blocks (co.ts)

wait, once(anim), hold(anim, s), walkTo, jumpTo(step) (crouch → ballistic launch with clumsiness error → landing anim), goTo(surface, x) (plans with the planner, replans up to 3 times), recover.

Tasks

  • tasks.ts: idle, wander, explore (surface picked by distance/height, avoiding recent ones), extra idle anims, sleep, follow (walk to cursor, look up/down with hysteresis, turn only past 0.3 u, jump to the surface under a still cursor), startle (run away).
  • social.ts: react (+ FX cues), petted (roll after 4 quick clicks), wakeUp, squish (long press), purr, eat, watch (typing), afterRagdoll.

Input

input/PointerInput.ts on the hitbox: click (counts within 1.6 s), long press (450 ms), drag past 6 px → ragdoll, hover strokes. It also tracks the global cursor (position, speed) for follow/startle.