mirror of
https://github.com/Louis-CFM/coucou.git
synced 2026-12-07 07:32:35 +09:00
remove-node-modules-link
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f4bfb499d8 |
iPhone step 3: CoucouKit (shared Mochi, pills, diff, models) (#210)
* iPhone step 3: CoucouKit, the code shared by the Mac and the iPhone Moves BotEngine, the outfits, the wardrobe, PillCatalog, DiffEngine and the models (IslandTypes, IslandScreenGeometry) unchanged from Sources/App to Sources/CoucouKit, plus the hex color helpers. The Mac targets still compile all of Sources/, so nothing changes for them; the iPhone target now compiles CoucouKit too. Adds MochiStill (one frame, no timer) and a CoucouKit preview screen on the iPhone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p * CoucouKit: CGColor.white/.black/.clear for iOS (macOS-only in CoreGraphics) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
b5d2242126 |
Mochi wardrobe: outfits, seasons and physics (#195)
* feat: Mochi wardrobe — right-click for outfits, auto seasonal dressing Outfit model (MochiWardrobe.swift): - 17 outfits with stable UserDefaults rawValues (mochiOutfit key) - seasonal() with Meeus/Jones/Butcher Easter algorithm - Windows: witch hat Oct1-Nov1, santa Dec1-26, party hat Dec31-Jan2, hearts Feb13-15, bunny ears Easter±2/+1, sunglasses Jun21-Aug31 - resolved() respects manual selection or falls back to seasonal Drawing (MochiOutfitDrawing.swift): - All accessories drawn in code: hats follow head yaw (sin/cos foreshortening), glasses at eye level, scarf on lower body, bunny ears behind body - Fade during mailbox morph (>0.3), heavy roll, and R≤14 (compact) - Pumpkin: orange body gradient overlay + ribs + stem/leaf - isMini bots never wear outfits Wardrobe view: - Right-click bot head → expands to .wardrobe; right-click again closes - 30pt pill grid with static Canvas accessory icons, scroll + bottom fade - Hover previews outfit on live Mochi; click selects + saves + pop sound - Escape or house tab closes; header shows current/seasonal selection Tests: 52 cases (seasonal boundaries, Easter 2026/2027/2028, rawValue stability, unknown UserDefaults value → .auto) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * redesign: complete wardrobe visual overhaul Visual iteration loop via new render script (scripts/render-outfits.sh + scripts/RenderOutfits.swift): produces /tmp/coucou-outfits.png showing all outfits at 5 angles (yaw ±0.45, front, pitch −0.45, compact). Catalog: remove topHat, cap, strawHat, heartsHeadband (4 outfits dropped, 13 remain). Feb 13–15 seasonal now returns .none. MochiOutfitDrawing.swift — full rewrite: - mochiEyePositions() shared helper: glasses anchored to exact eye positions - Hat mount system: hatBrimY/hatXS/hatBrimW helpers + split-brim technique (back brim drawn behind body, front brim + crown drawn in front) - Party hat: pink bezier cone, white dots, round pompom (not star) - Beanie: blue gradient, ribbed cuff, white pompom springing with sy - Crown: gold base band, 3 rounded arch points (taller ptH=R*0.56), 3 pearls - Witch hat: purple droopy bezier cone, orange ribbon, gold buckle, wide brim - Santa hat: red droopy cone, puffy white ellipse band, white pompom - Sunglasses: 2.3× eye width dark lenses on actual eye positions, bridge - Round glasses: brown #92400E circular frames on actual eye positions - Scarf: thinner (ry*0.22), lower (ry*0.55), red + two white stripes + fringe - Pumpkin: 4 soft ribs + curved green stem + leaf; guard changed to !isMini - Bow: bezier wings with highlights BotEngine.swift: - Pumpkin guard: bodyColor == nil → !isMini (works with integration pills) - lerp: private → internal (shared with MochiOutfitDrawing) - triggerEmote(.proud): add squash() for pop effect on wardrobe tap BotCanvasView.swift: - Remove .onChange(of: resolvedOutfit) block (was firing on hover/scroll not just explicit clicks) AppState.swift: - resolvedOutfit: per-day seasonal cache avoids recomputing Easter math on every frame IslandViewContent.swift: - .none icon: horizontal dash → circle with diagonal slash (⊘) - Remove drawTopHatIcon, drawCapIcon, drawHeartsHeadbandIcon, drawStrawHatIcon - Remove their cases from drawOutfitIcon() - Remove outfitIconHeart (only used by removed functions) tests/MochiWardrobeTests.swift: - Feb 13–15 seasonal: heartsHeadband → none - Remove topHat/cap/heartsHeadband/strawHat rawValue tests - Add: removed rawValues ("topHat", "cap", "heartsHeadband", "strawHat") stored in UserDefaults → .auto (backwards compat) - 57/57 tests pass Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: port outfit drawing to 3D reference implementation Replace the hand-crafted outfit drawers with a faithful Swift port of design/outfits/mochi-outfits.js — a Canvas 2D reference that reproduces the exact same body geometry as BotEngine (same R/rx/ry, superellipse, drawEyes formula). Key concepts ported from the JS: - MochiH struct: head geometry + physDx/physDy spring offsets - EyeFrame / mEyeFrames(): shared eye-position helper (replaces mochiEyePositions), used by both BotEngine.drawEyes and glasses drawers - 3D projection: mRingR, mRot3, mProj, mSurf — accessories follow the head with VIEW_TILT = -0.30 and ACC_PITCH = 0.4 (hats don't flip over) - Arc helpers: mFrontArc, mCapClip, mFrontRun — front-visible arcs of spherical rings for realistic 3D wrapping - mInvert + FillStyle(eoFill:true) — even-odd clip for beanie cuff etc. - drawPompom: 11 overlapping radial-gradient bumps - drawFuzzyBand: layered stroke with bump highlights (santa trim) Outfit improvements: - Beanie: knit meridian ribs, folded cuff via invert clip, physDx pompom - Santa hat: bezier bag shape, fuzzy trim arc, physDx/physDy tip spring - Party hat: 3D ring base, apex with physDx lean, polka dots, gold rim - Crown: back half behind body, front half with coloured gems + gold tips - Witch hat: witchBrimPts wobble + droop, physDx/physDy bent cone tip - Sunglasses: temples to head edge, body-clipped lenses, glare stroke - Round glasses: curved bridge, per-eye foreshortening, inner arc shine - Scarf: frontArc-wrapped band, meridional stripes, physDx hanging knot - Pumpkin: bodyColors ['#FFA94D','#E8590C'] replace the body gradient (not an overlay), 5 meridional ribs following proj - Bow: 3D anchor at surf(0.86, 0.55, 1.02), rotates + scales with yaw BotEngine.swift: - physDx/physDy/physVx/physVy: damped spring (stiffness 60, damp 9) driven by yaw velocity and oy velocity; updated each frame - drawBody: pumpkinColors param replaces the orange overlay approach - drawEyes: refactored to call mEyeFrames(), keeping roll in eyePitch - drawOutfitBehind/Front: build MochiH with physDx/physDy, call new sigs IslandViewContent.swift: - Wardrobe pill icons: each outfit shows a tiny Mochi wearing it (yaw=0, pitch=0, same render pipeline as live app, R=W*0.62*0.3) - .auto: sparkles, .none: circle-slash — unchanged - All individual draw*Icon functions removed (~200 lines deleted) scripts/RenderOutfits.swift: - Columns match sheet.html exactly: L(-0.5), front, R(0.5), up(p0.4), down(p-0.5), tilt(y0.3/p-0.25/t0.12) + small pill preview - Outfit order matches reference: none, beanie, santaHat, partyHat, crown, witchHat, sunglasses, roundGlasses, scarf, pumpkin, bow - Scale 0.62, W=190 (same as sheet.html), small=64 design/outfits/: - mochi-outfits.js: JS Canvas 2D reference implementation - mochi-outfits-reference.png: target planche (7 columns × 11 outfits) - sheet.html: page that generates the reference planche Both schemes build clean. All 9 test scripts pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: outfit integration bugs, physics spring, presence transitions, roll §1a — pumpkin body color: skip integration pill bodyColor when pumpkinColors=true §1b — remove R>14 size guards; add simplified mode (no ribs/dots/gems) for R<16 §1c — rewrite mFrontArc/mFrontRun: silhouette tangent split (min-x / max-x), pick the higher-z arc — eliminates left-edge jump on yaw §1d — wardrobe pill icons: R=10, cy+0.62×R shift gives hat headroom §2 — outfit only on main pill, compact/peek, or wardrobe view; hidden otherwise §3 — physics impulses: slap (physVy−=1.2, dx±=0.7), squash (physVy+=0.6), greet (physVx+=0.2) §4 — outfitPresence (0→1 Ease.back 350ms / 1→0 180ms) via BotEngine.setOutfit(); outfit change: exit old then enter new; wardrobe preview: instant §5 — add roll to MochiH; mProjRoll for roll-following accessories (scarf, glasses, bow, pumpkin); z-based rollFade replaces fixed threshold for those accessories; hats keep fixed 1.2rad threshold §6 — auto pill icon: seasonal Mochi + AUTO badge (capsule, 60% black, 7pt semibold) renderer: add roll planche (6 angles 0..5π/3) and transition planche (p=0..1) Visually verified via rendered planches: outfits, roll, transition all look correct. Both schemes build (NotchBuddy + CoucouAppStore). All tests pass (57/57). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: outfit transitions with movement, hat fly-off, roll front/behind switching, wardrobe hover header §1 Transitions — movement, not just opacity - outfitPresence tween uses Ease.inOut; Ease.back applied to position offsets in drawing code - Hats / crown / bunnyEars: enter from (1-posP)×0.6ry above with (1-posP)×0.3rad rotation - Glasses: slide down (1-p)×0.15ry on entry/exit - Scarf: slide down (1-p)×0.2ry - Bow: scale by p; pumpkin opacity only (body color driven by drawBody) - squash() fired in entry tween completion for landing bounce §2 Hat fly-off during doRoll - rollTurns stored in BotEngine; squash() called at roll end - Progress = roll / (2π × rollTurns); hat rises 0.9ry × sin(progress×π), self-rotates by H.roll, drifts physDx×0.4rx × sin(progress×π) - Removed abs(roll)>1.2 threshold; crown and witch hat back parts fly in sync §3 Roll-following accessories switch front/behind (no z-fade) - Front pass: roll-following outfits (sunglasses, roundGlasses, bow, scarf, pumpkin, bunnyEars) skip when mProjRoll(H,(0,0,1)).z < 0 - Behind pass: draws them when anchorZ < 0 using same drawing functions - bunnyEars: now uses mProjRoll for ear positions (ear width foreshortened from projected spread); included in roll-following set §5 Wardrobe hover header - hoveredOutfit takes priority over selection in headerRight - Auto hover → "Auto · follows the seasons (now: <name>)" - Any outfit hover → outfit displayName Transition planche (p=0,0.3,0.6,1): hats enter from above with overshoot bounce; scarf slides up into position; bunnyEars rise in; all invisible at p=0. Roll planche (6 angles): hats spin above head and land; glasses/bow/scarf/pumpkin/bunnyEars follow roll and flip between front/behind at anchor-z zero-crossing, no fade artifacts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: hat roll is a flat 2D spin, bunnyEars flatten; drawLayer removes ghost overlap Roll corrections: - Hat fly-off (beanie, santaHat, partyHat, crown, witchHat): drawn with mProj at roll=0 (no 3D twist), then ctx-translated up (0.9ry × sin(πu)), rotated 2πu around the hat's own pivot (-1.4ry in body space), drifted physDx×0.3rx×sin(πu). Crown and witchHat back parts fly in sync with the same transform. - bunnyEars: removed from roll-following set; always drawn behind body via drawBunnyEarsBack with mProj (not mProjRoll). During roll: height × (1 - 0.8×sin(πu)), outward tilt ±0.6×sin(πu) rad per ear; snap-back squash comes from doRoll completion. Transition corrections: - All accessories rendered inside ctx.drawLayer { } to prevent internal alpha bleed (overlapping shapes no longer show through each other or through the head). - Opacity = min(1, p × 2.5): fully opaque by p = 0.4; movement carries the entry. - Movement scaled up: hats/crown/ears → (1-posP)×1.0ry up + scale 0.85+0.15×posP; glasses → (1-p)×0.25ry down; scarf → (1-p)×0.3ry down. - morphFade (mailbox morph) applied to layer so no ghost during that fade either. Roll planche: hats above head, upright → spin flat → land; bunnyEars squash at roll=π. Transition planche: no head visible through witchHat/santaHat at p=0.3; scarf slides up. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: hat roll — gentle swing instead of full spin, reduced rise to 0.45ry - Rise: sin(πu) × 0.45ry (was 0.9ry) — hat stays within the Mochi canvas bounds - Rotation: sin(2πu) × 0.35 rad flat swing — hat never goes upside-down - Drift: physDx × 0.2rx (was 0.3rx) - Same values applied to crown and witchHat back parts in behind dispatcher Roll planche: all hats visible and upright across all 6 angles. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: rigid-plane roll for outfit-wearing Mochi When resolvedOutfit != .none and outfitPresence > 0.05, the entire character (hands, outfit-behind, body, eyes, outfit-front) is drawn inside a context rotated by `roll` around the body centre. The body genuinely turns in screen space rather than producing an eye illusion. - BotCanvasView: branch on rigid vs illusion roll; badge+particles (drawHandsAndExtras) remain outside the rotated context. - BotEngine.drawOutfitBehind/Front: pass roll=0 to MochiH and the static dispatchers when outfit is present, so accessories sit fixed on the head and co-rotate with the body transform. Hat fly-off and bunnyEar flatten code auto-disables (triggered by H.roll, now 0). - BotEngine.drawEyes: suppress roll addition to eyePitch when outfit is shown (no roll-through illusion needed; body rotates for real). - BotEngine.bodyCenter(size:): new helper exposing cx/cy to callers. - BotEngine.update: centrifugal physDx impulse proportional to roll angular velocity when Mochi wears an outfit (coefficient 0.18). - Outfit .none kept on illusion path exactly as before. - Roll planche: added .none row to verify illusion unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(SPEC): update wardrobe section and activity grid Wardrobe: - Add outfit visibility rule (only shown when focusId == mainPillId, island not expanded, or view == .wardrobe). - Document transitions (presence, drawLayer, Ease.back, per-accessory offsets) and physics (physDx/physDy spring, squash impulse, centrifugal force during roll). - Document rigid-roll mechanic (outfit present) vs illusion roll (none). - Auto pill: badge "AUTO" + season name on hover. - Stable IDs updated to current set; removed values migrate to auto. - Remove Valentine's Day from season calendar. - Add design/outfits/ and scripts/render-outfits.sh as visual reference. Activity grid: correct cell size to 7 pt, spacing 1.5 pt, ~23 weeks (calculated from available width). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> |