Skip to content

Fill see-through corner gaps on rounded dice during rolls#113

Merged
AdamTyler merged 1 commit into
masterfrom
fix/rounded-die-corner-gaps
Jun 23, 2026
Merged

Fill see-through corner gaps on rounded dice during rolls#113
AdamTyler merged 1 commit into
masterfrom
fix/rounded-die-corner-gaps

Conversation

@AdamTyler

Copy link
Copy Markdown
Owner

Summary

When dieCornerRadius is large, a rolling die would flash the page background through its 8 corners. A rounded die is a hollow CSS cube — each face carries border-radius, so the rounded-away corners of adjacent faces leave see-through gaps at the vertices while the die spins.

Fix

Render a solid inner core cube in faceColor while the die is mid-roll (new isRolling state). It sits strictly inside the shell silhouette, so it backs the gaps with the die's own color without ever poking past the faces. The fillers:

  • Only render during a roll — at rest the die sits face-on and shows no gaps
  • Are skipped when dieCornerRadius is 0 or would consume the whole die
  • Are marked aria-hidden and carry no pips, so they're purely cosmetic

Notes / trade-off

An earlier iteration also added flat corner-cap discs at each vertex for pixel-perfect corners, but flat discs tilted along the cube diagonal produced visible artifacts (floating circles / a lumpy silhouette) at certain rotation angles. Those were dropped in favor of the core-only approach, which is geometrically robust. The remaining trade-off is that very small dark pinholes can appear right at the 8 vertices during fast spins — a deliberate, far-less-noticeable compromise.

Verification

  • npm run build — passes
  • npm test — 43/43 pass (includes tests for the core rendering only while rolling, sizing, and the skip conditions)
  • ⚠️ Visually checked on the demo by the author; reviewers should confirm the roll looks clean in a browser.

🤖 Generated with Claude Code

A rounded die is a hollow CSS cube: each face carries border-radius, so at
large dieCornerRadius the rounded-away corners of adjacent faces let the page
background show through the 8 vertices while the die spins.

Add a solid inner core cube in faceColor that renders only while the die is
mid-roll (new isRolling state). It sits strictly inside the shell silhouette,
so it backs the gaps with the die's own color without ever poking past the
faces. The fillers are skipped when cornerRadius is 0 or would consume the
whole die. At rest the die sits face-on and needs no fillers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@AdamTyler AdamTyler merged commit 8aee55c into master Jun 23, 2026
1 check 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