mesh-avatar-studio
Turn one illustration into an animated 2D mesh avatar with a coding agent and a local editor
翻譯準備中
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證貼紙倉庫
AI 翻譯
A repository for stickers
取自儲存庫 README
正在載入完整 README。 以下為已儲存的摘錄。
Live demo: arn.as/stickers — works on desktop and phones.
A sticker playground in the browser. Open a pack, grab a corner, peel one off and slap it onto a notebook.檢視完整 README ↗Live demo: arn.as/stickers — works on desktop and phones.
A sticker playground in the browser. Open a pack, grab a corner, peel one off and slap it onto a notebook.
npm install
npm run dev # http://localhost:4791
npm run check # type-check, formatting, unit tests
npm run e2e # browser smoke test: peel, carry, drop, make your own
npm run build # static site in dist/
src/peel/model.ts)A sticker is treated as an inextensible sheet. A peel is fully described by a fold line (direction d and position f), a curl radius r and a wrap angle θ:
r for up to θ radians;Arc length is preserved, so the sticker never stretches (the tests check this numerically).
The harder part is the inverse problem: given where the pointer is, find the fold so that the point you grabbed lands under the cursor.
s − r·sin(s/r) along the peel direction while it's on the curl, which is solved with guarded Newton iteration, and (reach + πr)/2 once the flap lies flat on top.The pointer target is spring-smoothed and the fold direction is blended, so switching between the two cases never snaps. Releasing early sends the target back through an underdamped spring, so the flap slaps down.
Once a sticker is free, it's carried by the exact point you were holding (pivot · tilt · yaw · translate(−grab), using the grab point's curled position). That's why a freshly popped flap unfolds around your fingers instead of jumping.
src/peel/wrap.ts)Stickers that hang past the notebook's edge fold over it, run down the side and continue onto the desk. Each point's distance from the edge is kept the same, so the sticker doesn't stretch here either.
src/stickers/factory.ts)Each sticker's die-cut silhouette is rasterised to a coarse mask. A chamfer distance transform of that mask gives two things at any point:
The gradient sends a corner grab along the bisector and an edge grab straight in. Picking raycasts the deformed meshes, then checks the hit's UV against the mask, so the transparent part of the quad can't be grabbed.
Geometry. A resting sticker is two static meshes cut from its silhouette: an opaque core and a thin alpha-tested edge band (src/stickers/split.ts). The GPU can skip whatever the opaque core covers, so a pile of overlapping stickers costs roughly one layer, not all of them. A sticker that's curling, wrapping or flying switches to an 84×84 grid that the CPU deforms only on frames where something changed. It shares that grid between its printed front and an adhesive-paper back face.
Soft shadows. src/scene/pcss.ts patches three's shadow lookup with percentage-closer soft shadows. A blocker search estimates how high the occluder is and widens the filter to match. A lifted corner gets a tight contact shadow, and a sticker held 3 cm up throws a broad, faint one. Two things keep it cheap:
Holographic foil. src/stickers/materials.ts injects a foil pass into the sticker material before lighting:
Foil is masked per sticker, so the ink and faces stay printed.
Generated assets. Textures, die-cut borders, the kiss-cut sheet (with liner holes and a roughness map for the glossy liner) and all sounds are generated at runtime. The peel crackle is a stream of band-passed noise grains whose density follows the speed of the peel front.
Nothing is drawn unless something changed. The frame loop (src/loop.ts) goes to sleep entirely when the scene is still and wakes on input. The only thing that wakes it on its own is the "peel me" corner's occasional flutter on the opening screen, which stops once you've peeled something. Shadows are re-rendered only when something that casts one moves. Passive motion (parallax, settling springs) is capped at 60 fps, while dragging gets the display's full rate. Pixel ratio is capped at 1.5 and drops on slower GPUs.
Measured on an M4, 1920×1080 window at 1.5× (2880×1620 pixels):
| Scene | GPU per frame |
|---|---|
| Opening view | ~2 ms |
| 92 overlapping stickers | ~5 ms |
| Idle (nothing moving, no flutter in progress) | no frames |
| File | What it owns |
|---|---|
src/peel/model.ts | peel geometry and the drag → fold solver (pure, tested) |
src/peel/wrap.ts | wrapping over box edges (pure, tested) |
src/playground.ts | interaction state machine: hover, peel, carry, drop, layering |
src/stickers/factory.ts | art → die-cut sticker, masks, distance field |
src/stickers/sticker.ts | per-sticker meshes, pose and deformation |
src/stickers/split.ts | resting sticker → opaque core + alpha-tested edge band |
src/stickers/materials.ts | gloss / matte / holo materials, shared per design |
src/stickers/art.ts | the ten characters, as SVG |
src/scene/* | renderer, camera, desk, notebook, sheet, PCSS |
src/loop.ts | frame loop that sleeps when idle |
src/view.ts | camera: opening shot, desk tilt, pointer/gyro parallax |
src/library.ts | sticker designs (built-in and user-made), built once and cached |
src/composition.ts, src/persist.ts | saving the desk, share links (tested) |
src/ui.ts | toolbar, sticker maker, hints |
src/audio.ts | synthesised sound |