A dark-warm, cozy pet-care app rebuilt from three UI design boards — four tabs, two full-screen sub-pages, a hand-drawn vector pet, and a full gesture layer.
功能与使用说明(带截图) 在
guide/index.html,直接双击用浏览器打开即可, 无需启动服务。内容包括快速开始、跳转与手势对照表、六大页面逐个说明、 七种萌态动效图鉴和实现原理。
npm install
npm run dev # http://127.0.0.1:5177npm run build type-checks and produces dist/. Open on a phone-sized viewport
and the shell goes edge-to-edge automatically.
Four tabs live in a horizontal pager. Two sub-pages push on top of the active tab with a real back stack.
Home ─┬─ Little looks (pushed, full-screen, no tab bar)
└─ Momo's corner (pushed, full-screen, no tab bar)
Tasks
Explore
Album
| Input | Result |
|---|---|
| Swipe left / right on content | next / previous tab, with rubber-band at both ends |
| ← → arrow keys | same, for desktop |
| Tab bar | jump straight to any tab |
| Coral paw | returns Home and gives Momo a pat |
| Home → "Little looks" / "Momo's corner" card | pushes that sub-page |
| Swipe right from the left edge | pops the sub-page (drag follows your finger) |
| Esc / Back chevron | pops the sub-page |
| Tap Momo | pat |
| Swipe up / down on Momo | walk through his care moods |
Anything you change is shared across every screen — buy a Mint Scarf in the wardrobe and Momo is wearing it on Home, Tasks and Explore immediately.
Tap feedback is a chain: ripple ring → sparkle burst → skeletal animation → mood bubble. Repeated taps cycle the cheeky reactions:
happy → love → wink → surprise → happy …
Feed / Play / Rest drive their own moods (chew / happy / sleepy).
| Mood | Performance |
|---|---|
idle |
breathing, slow blink, tail sway |
happy |
bounce, both arms up, closed-arc eyes, tongue out |
love |
heart eyes, floating hearts, shy head tilt |
surprise |
pop, wide eyes, O-mouth, ears shoot up |
sleepy |
dozing sway, drifting Z's, drooped ears |
chew |
chomping jaw, head bob, ear wiggle |
wink |
single-eye wink, head tilt, arm up |
Open ?lab for a live contact sheet of every mood, accessory and scarf tone.
src/components/Otter.tsx draws Momo as layered SVG with independently
animatable bones — head, ears, eyes, mouth, arms, feet, tail, body, accessory.
Each mood in otter.css is just a set of keyframes bound to those bones, so
moods compose instead of being separate drawings.
Changing the nonce prop remounts the SVG and restarts every animation from
frame 0, so rapid taps always replay cleanly.
The vector otter stands in for a rendered bitmapped pet. To use your own:
- Drop the images in
public/. - Replace the
<svg>insrc/components/Otter.tsxwith an<img>. - Keep the
data-moodattribute and put your art variants behind it ([data-mood='happy'] { … }) — the whole reaction system keeps working.
Each screen is a real 390×844 viewport. The status bar is a reserved strip and the screen fills the remainder; every page is verified to fit its frame with zero overflow.
src/
App.tsx shell: tab pager, sub-page stack, keyboard
nav.tsx navigation model (tabs + push/pop stack)
gestures.ts useSwipe · useEdgeBack · useIsMobile
components/ Otter (the rig) · PetStage (tap FX) · Chrome · Icons · Phone
screens/ one file + one stylesheet per screen, MeadowMap, PetLab
styles/ tokens.css (colours/radii/shadows from the boards) · shell.css · app.css
state.tsx shared store + per-screen pet performance
- All artwork is hand-authored SVG/CSS — no image assets, no icon library.
prefers-reduced-motioncollapses the animation loops while keeping each mood's final pose readable.- Drags are tracked with window-level pointer listeners rather than
setPointerCapture, and a completed drag swallows the synthetic click so a swipe never accidentally presses a button it travelled across. - Fonts fall back through Baloo 2 → Nunito → system rounded faces; none are bundled, so the UI stays self-contained.
The layout, colour system and copy are reproduced from three "Momo the otter"
UI design boards (watermark UI DESIGN, credit @K-UI设计(投稿),
小红书号 Zz_JH25). Those boards remain the property of their author; this
repository is a non-commercial study in rebuilding them as working code.
The pet itself is the one deliberate substitution: the boards use a photorealistic 3D-rendered otter, which cannot be reproduced as vector art, so Momo here is a hand-drawn SVG stand-in wearing the same scarf and poses. The UI shell is faithful; the otter is an interpretation. See Swapping in real artwork to drop the original renders in.
MIT for the code. The design boards referenced above are not covered by it.
