Skip to content

Restyle component circles: gradient fill, drop shadow, tier-3 pulse#100

Merged
pzverkov merged 2 commits intomainfrom
feature/canvas-component-restyle
Apr 23, 2026
Merged

Restyle component circles: gradient fill, drop shadow, tier-3 pulse#100
pzverkov merged 2 commits intomainfrom
feature/canvas-component-restyle

Conversation

@pzverkov
Copy link
Copy Markdown
Owner

What

Each component body on the canvas now has:

  • a soft ctx.shadowBlur drop shadow under the base fill,
  • a top-left radial-gradient highlight overlay (subtle "lit from above"),
  • a ~0.6 Hz sine pulse on the tier-3 ring (alpha 0.18..0.40, radius +7..+11).

Tier-2 keeps its existing static ring. Health ring, down indicator, selection glow, type label, and tier badge are untouched, so the information density a returning player relies on is preserved.

Why

Flat circles read clearly but flatly. The gradient + shadow give each node a tangible "object" feel that makes the graph easier to scan for newcomers, while staying restrained enough not to distract senior players who are tracking health + tier at a glance.

How

  • Component body is now: save() set shadow, fill base color, restore(), fill gradient overlay, stroke border. The save/restore keeps the shadow from bleeding into the stroke/label drawn next.
  • A small ensurePulseLoop() rAF loop drives redraws only while any tier-3 component is on screen AND sim.running. It self-terminates otherwise, so paused / idle runs cost nothing.
  • The sine phase is pinned to 0.5 in IS_E2E so snapshots stay deterministic; the loop itself now runs in E2E so the new visual-smoke spec can probe it.

No gameplay change. Not localized (canvas only).

Test plan

  • npm run test:unit (143/143 pass)
  • npm run test:e2e:ci (26/26 pass on desktop + mobile projects)
  • npm run build clean; entry grows ~0.3 KB gzip
  • New tests/e2e/canvas-restyle.spec.ts:
    • Places a UI component, forces it to tier 3 via __SIM__, starts the sim; window.__PULSE__.active flips to true within one frame
    • Samples canvas device pixels within a 60-px square of the component; a gold-ish pixel (tier-3 ring colour, high R / high G / low B) is present
    • Pausing the sim flips __PULSE__.active back to false within the timeout

- Each component body gets a radial-gradient highlight overlay (top-left
  lit) on top of the existing base color, plus a soft ctx.shadowBlur drop
  shadow. save/restore isolates the shadow state so it does not bleed
  into the stroke, label, or tier badge drawn on the same component.
- Tier-3 components now breathe: the surrounding ring alpha (0.18..0.40)
  and radius (+7..+11) animate on a ~0.6Hz sine. Tier-2 keeps the
  existing static ring. A small rAF loop (ensurePulseLoop) drives
  redraws only while any tier-3 component is on-screen AND the sim is
  running; it self-terminates otherwise so paused / idle runs cost
  nothing.
- IS_E2E skips the pulse entirely and pins the phase to 0.5, keeping
  snapshot timings deterministic.

No gameplay change. Health ring, down indicator, selection glow, type
label, and tier badge render identically to before.
- main.ts: drop the IS_E2E early-return in ensurePulseLoop so the rAF
  loop actually runs in headless runs (the sine phase was already pinned
  to 0.5 in draw() so snapshot timing stays deterministic). Expose a
  small window.__PULSE__ probe under IS_E2E with an active getter.
- tests/e2e/canvas-restyle.spec.ts: place a UI component, force it to
  tier 3 via __SIM__, start the sim, and assert the pulse loop is active
  and a gold-ish pixel is painted within 60 device px of the component
  centre. Click pause and assert the loop terminates within the timeout.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
app-survival-android 0fefe90 Commit Preview URL

Branch Preview URL
Apr 22 2026, 11:57 PM

@pzverkov pzverkov self-assigned this Apr 22, 2026
@pzverkov pzverkov merged commit 8cc4352 into main Apr 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant