Spaces:
Running

hugging-space / BACKLOG.md
Chunte's picture
Chunte HF Staff
Close filled paths without z (PyTorch inner bow)
3811766 verified
|
Raw History Blame Contribute Delete
15.8 kB

Backlog

Logo squish: follow-ups

On (src/warp.ts): the pressed section of the logo's outer edge bows inward as one round bow (sine between the bend points Γ— cosine falloff around the hug direction; no flat zone, so it stays round when the logo is pushed further in). Re-check / re-tune with tools/refcheck.

Pocket bow: every pocket wall Huggy's swell presses on bows into the stroke so the opening grows (default 12 px). Limits keep curves round: a stroke keeps β‰₯ 35% of its width (minThickness); when two bows squeeze one stroke from both sides the stronger wins and the two together take ≀ 30% of its width (twoSided); bows ease smoothly instead of clipping; sharp corners (> 35Β°) never move, so each wall bows on its own.

Global squish rule: one squish level (how deep the logo reaches inside Huggy) drives the edge bow, the pocket bow and Huggy's swell; it ramps from the bend start to full at fullDepthΒ·R.

Freeze depth: past freezeDepth (default 0.6R inside Huggy's rim) the logo's squish shape is captured once and reused, so pushing deeper (or sideways while deep) no longer changes it; pulling back out blends to the live squish over 0.04R.

Open issues:

  • Strong pocket bows (e.g. 26 px) still make thin strokes wobbly: the inside and outside of a stroke bend in different places. Tried a single smooth push field (2026-11-06): no wobble, but it distorted the logo too much, so it was reverted (backup in /tmp/hug-backup-pushfield-*).
  • Per-logo depth differs in the references; a single rule can't match all three exactly.
  • Body bulges and hand grips still read the un-squished logo (edges move up to ~30 px).
  • Stroke-only shapes and <use>-referenced geometry are not squished.

v8 (current): lower-left pocket wall

From the Figma Pydantic frame: the edge bow only bends the logo's outer silhouette; in each angular pocket (β‰₯ 2 sharp corners) Huggy swells into, only its lower-left wall (in the logo's own upright orientation) gives way, slightly (10 px max, grows with depth). Round pockets (Fal, OpenRouter) have no lower-left wall: each stretch of their wall inside Huggy gives way as one arc instead.

Rule above all: the pocket bend only happens on the part of that wall that is inside Huggy's outline (never "squished by air"). It starts at the sharp corner if the corner is inside Huggy, otherwise where the wall enters Huggy, and ends where the wall last leaves Huggy.

Shape: one circular arc (a "moon curve": steep at both ends, round in the middle, no slow-down at either end), kept exact (no smoothing pass over it). Thickness limit for these arcs: both sides of the stroke together keep minThickness (the "stronger side wins" budget would wipe them out next to a strong edge bow); if it has to shrink an arc, the whole arc shrinks evenly. Bezier handles are rebuilt from the anchors (cubic Hermite) so the bend has no kinks, and v8 subdivides paths at 1% of the logo size (was 2%) so the bend ends land within a few px of Huggy's outline. vs the Figma frame: pocket walls 1.6 px mean error (v7 2.6), outer edge 7.7 px (v7 9.3).

Edge bow (v8): one circular arc between its two bend points (moon curve) instead of a sine Γ— cosine bell (which read as a wave); only the last ~4–14 px at each end are softened slightly. The arc is a target shape, not an offset: each point slides inward along its normal onto it, so a big round edge (OpenRouter's O) becomes a concave moon arc instead of keeping its bulge. The dent over the chord is the bow depth, shrinking to β‰₯ 0.3 Γ— depth on round edges so no point moves more than 2.2 Γ— depth; if it still would, the bend is shortened from both ends. The bend keeps its usual width (from startDepth inside the rim; widening it to the whole intersection with Huggy was tried and read as too wide). Mean distance to the Figma hugged outline: OpenRouter 20.2 β†’ 12.0 px; Pydantic (6.5 px) and Fal (12.3 px) unchanged.

Freeze (v8): only the edge bow freezes past the freeze depth; pocket bends keep following Huggy's intersections at any depth (v7 froze the whole logo shape, pocket bends included).

Huggy's swell (v8): one circular arc across each pocket (through the two points where the rim enters / leaves the pocket, apex at the swell height), instead of the soft sin-shaped dome that eased into the circle like a wave. The springs' neighbour tension now acts on the deviation from that arc, so Huggy still wobbles but settles exactly on it. v1–v7 keep the dome. Each pocket gets the tallest arc (up to the shared swell height) that stays a gentle crescent (height ≀ 0.6 Γ— half its width) and keeps Huggy's outline β‰₯ stroke/2 + 4 px inside the pocket walls, so narrow angular pockets get a smaller round swell instead of a pointy one. Rays where the pocket wall is too close to the rim rest on the circle, and edge rays with little room may be left out of the arc when that gives a much fuller swell (best height Γ— width); otherwise one tight edge ray made the whole swell vanish (31 of 181 test pockets). Drawing: the outline is a smooth spline through the 192 ray points, which rounded each arc's ends over ~9 px a side (small swells read as a wave). A sharp corner point is now added where each arc meets the circle (halfway between its end ray and the resting ray next to it).

Bend spread (logo.zeroDeg) defaults to 40Β° in v8.

Squish shadows (v8): along every pocket bow, two thin moons share the bent wall as their base and close at the bow's ends (as in the Figma hugs, e.g. OpenRouter's shadow_2 / shadow_5):

  • logo side: from the wall into the logo, 1.5 Γ— the local bend depth thick; black at 20% (= the Figma darker purple, 0.8 Γ— the logo colour, for any logo colour);
  • Huggy side: from the wall into the pocket, 0.8 Γ— the bend depth; Huggy's yellow multiplied over the body (= the Figma #FFAD05 on Huggy), clipped to Huggy's body. Edge bow: a logo-side moon only, 0.45 Γ— the bend depth (Figma Pydantic shadow_4, OpenRouter shadow_4); no Huggy-side shadow. Moons under 0.75 px deep or 15 px long are skipped. Both scale with the bend, so they fade in and out with the hug. Placement vs the Figma frames: within ~10 px for the pocket moons; the edge moons cover the same stretch, ending ~40–50 px shorter on Pydantic's left edge. Open: in the Pydantic frame the Huggy shadow of the lower pocket sits on the pocket's top wall (unbent), not on the bent lower-left wall; Figma may not honour mix-blend-mode on SVG import.

Cheek squish (v8): the mouth cover = closeness of the logo to the cheek (as before) Γ— the global squish level, so it starts and grows with the logo squish instead of ~40 px before the logo even touches Huggy. (When a pocket of the logo slides over the cheek point the cheek eases back off, as before.)

Hand shadows (all versions): each hand's silhouette (outline included) shifted 2 px left and 6 px down, as a 20% black overlay masked to the logo and drawn under the hands (Figma OpenRouter shadow_3 / shadow_6). They follow the hands every frame, pinned or not. Uses the logo alpha mask (mask-type: alpha), which Figma may not honour on SVG import.

v9 (current): one press arc

The edge bow is one press arc for the whole logo instead of one bow per path: the pressed edge points (same rule as v8's edge bow) are gathered from every path, split into groups where they're more than 15% of the logo size apart sideways, and each group gets one moon arc (same shape rules as v8: dent of the bow depth, moves capped at 2.2 Γ— depth, shortened if needed). Every non-pocket-wall outline point in front of the arc, from any path, moves onto it along one shared direction. Mistral (stacked bars): v8 bent each bar on its own (bar 2: 4 β†’ 14 β†’ 4 px, bar 3 a separate 5 px bump, top bar none); v9 bends the bars' left ends as one arc (0 β†’ 20.6 β†’ 0 px, continuous across bar boundaries). Single-edge logos vs the Figma frames: Pydantic 6.5 β†’ 7.0 px, OpenRouter 12.0 β†’ 11.8 px, Fal 12.3 β†’ 11.3 px. Edge freeze stores the press per point (move + direction).

v9 follow-up (Mistral feedback):

  • The pressed front is found per thin sideways slice (the candidate point furthest toward Huggy), so inner edges between stacked bars don't count. It splits into separate arcs where it has a 15% gap sideways or steps forward / back more than 6% of the logo size.
  • A recess only counts as a pocket for the press if Huggy swells into it near the rim (within 0.2 R inside); Mistral's bar ends set back from its protruding bottom bar are part of the pressed surface.
  • A front made of several paths bows along its whole length once any of it is within the bend spread; a single outline keeps the bend spread.
  • Edge shadow: one moon per press arc (the arc + a curvier arc through the same ends, 0.45 Γ— the largest move thicker), masked to the logo, frozen with the edge bow. Mistral now: bars 1–4 left ends bow as one arc (y 165–461, 0 β†’ 20.7 β†’ 0 px) with one shadow moon; the protruding bottom bar is its own front, outside the 40Β° spread, so it doesn't bend. Figma frames: Pydantic 7.3 px, OpenRouter 12.1 px, Fal 11.2 px.

Drag glitch fix (Mistral): the press front only takes points whose normal faces the press direction (cos β‰₯ 0.5). Before, the top edge of the protruding bottom bar (facing up, but a little toward Huggy's centre) could join the bars' front, tilting the arc so the bar ends sat behind it (no bend), until it split off and the full bend popped in (0 β†’ 6.8 px in 1 px of drag). Pocket bends now grow in with the swell (no on/off at the 0.05 gate), with the length of wall inside Huggy (10 β†’ 40 px) and with how deep it is inside (0 β†’ 12 px); Pydantic's pocket pop went from 5.2 to 1.5 px per px of drag. Drag sweep (1 px steps, settled): Mistral ≀ 0.9, Pydantic ≀ 1.5, OpenRouter ≀ 2.0 px change per px. Pocket entry (Fal's hole pop): each pocket swell is capped at 2 Γ— how far Huggy's rim has gone into the pocket (the pocket's extent inside the rim along each ray, refined below the 3 px scan step), so a swell starts at 0 as the rim crosses into a hole and grows with the drag; the pocket bend ramps with the swell over its whole range. Fal's hole: bend pop 4.9 β†’ 1.4 px per px of drag, swell enters from 0 (≀ 3.4 px step). v9 default swell amount 0.55 (was 0.75): fully pushed-in swell β‰ˆ 28 px instead of 35.5. Open: swell arcs still snap where two neighbouring pocket swells merge into one arc (Mistral, 17 β†’ 26.7 px at one spot) or the fit switches which edge rays it leaves out (Pydantic, ~5 px); springs ease these over ~0.2 s while dragging.

v10 (reverted): smooth swell fit

Reverted: blending trims / merges made the swells stop being clean moon arcs (a blend of arcs isn't an arc; merging swells showed two lumps). v9 is the default again.

v9 with Huggy's moon swells fitted smoothly, so a swell never snaps between shapes while dragging. Each ray's openness fades in (0 β†’ 1) with its room to the pocket's far wall and with how far the rim has entered the pocket there (both measured below the 3 px scan step). Runs of open rays are swells; inside one, a half-open ray blends "two separate swells" with "one merged swell" by its openness, and instead of picking one best trim, every trim's arc is blended (soft-max on height Γ— width, weighted by the openness of the half-open edge rays it includes). Settled 1 px drag sweep, biggest swell step: Mistral 9.6 β†’ 3.0 px, Pydantic 4.9 β†’ 2.7, Fal 3.4 β†’ 2.7, OpenRouter 2.3 β†’ 2.3 (the remaining ones are a swell first appearing at contact). Figma frames unchanged. Cost: up to ~5 ms per frame on Pydantic (v9 ~2.5).

v9 follow-up: stacked shapes and inner edges (Meta)

  • Stacked shapes (a base plus gradient / highlight pieces on top, e.g. Meta) bend as one: edges lying on each other (within 1.5 px) take the same move (the larger), and seams inside the logo are carried along by the outline's moves (fading over twice the move), so thin pieces compress instead of splitting into slivers or flipping their tips into spikes.
  • Inner edges, not just holes: any edge facing an empty space inside the logo counts, sealed hole or not (Meta's infinity is one self-crossing outline whose loop walls are just parts of it). Hole outlines keep the hole rules (lower-left wall / round stretch); other outlines have each stretch of inner edge split at its sharp corners, and the part inside Huggy gives way as one moon arc, with its shadows. Duplicate moons from stacked shapes are drawn once.
  • Thickness: a stroke pressed from both sides shares its squish budget in proportion to how hard each side presses (was: the stronger side took it all), so an inner edge behind a strong edge press still bends a little, with its shadow. Figma frames unchanged (7.3 / 11.2 / 12.1).
  • Shadow gap: on a thin stroke the edge moon and the inner-edge moon are sized to fit the stroke left after bending (shadowRoom: each side gets half of what's left minus SHADOW_GAP 4 px), so a strip of plain logo stays between them. Only shadow depths change, never the bend.
  • A short inner-edge arc lying on another stacked shape's longer arc is dropped (dropCoveredInnerArcs): it made a bump at the start of Meta's inner bow once edges synced.
  • Mistral drag glitches (from counting inner edges): an inner-edge moon is never deeper than its own bend (a faint inner bend along a wall the edge press moved drew a press-sized wedge that popped), and the inner-edge bend eases in/out over a few frames (easeInner), since Huggy's swell into a notch can vanish within a few frames as the notch slides past. Checked frame by frame over the normal range (logo not reaching the mouth); dragging deeper is out of scope.
  • Edge bow vs inner bow on a thin stroke (Meta pushed in): the thickness limit scales each press arc as a whole (limitPressArcs, 10th-percentile fraction of its points), so it stops growing as one clean arc instead of being dented where the inner bow meets it. Its shadow is drawn along the edge as bent (edgeMoon: the arc's Huggy-facing points at their final positions, inner side further in by thickness Γ— the arc's profile, tapered over 12 px at the ends), so it pauses with its bow (was: the un-pushed arc, offset from the edge), with thickness easing toward SHADOW_EDGE_MAX 14 px (it rose 0.45 px per px pushed and got heavy). A shorter inner arc on another shape's longer one is dropped from 30 % overlap (Meta's loop bottom kinked).

Contact shadow painting on the logo

Darken the partner logo where it presses into Huggy, like the shadow layers on the logos in the Figma references (OpenRouter, Pydantic, ai2).

State: implemented but switched off (SHOW_CONTACT_SHADOW in src/main.ts, contactShadowPath()). The current version draws tapered bands on logo edges that border a visible bulge (stroke far edge + far wall), offset along the logo edge normal and clipped by the logo mask.

Open issues before switching it back on:

  • Should follow the logo squish (the band is computed from the un-warped logo analysis).
  • Uses mask-type: alpha, which Figma may not honour when importing the exported SVG.
  • Look against the references hasn't been tuned (width, opacity, where bands start/stop).

Unclosed filled paths (PyTorch icon)

A filled subpath without a final z is drawn closed by the browser but was treated as an open outline, so it skipped the inner-edge rules (they need a closed outline) and fell back to the hole rule, which bends nothing: PyTorch's ring had no inner bow although Huggy swelled into it. Filled, unstroked subpaths are now closed on load (closeSubPath, a straight segment back to the start if needed). All samples and Meta already close their paths, so they're unchanged.