Fill see-through corner gaps on rounded dice during rolls#113
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
dieCornerRadiusis large, a rolling die would flash the page background through its 8 corners. A rounded die is a hollow CSS cube — each face carriesborder-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
faceColorwhile the die is mid-roll (newisRollingstate). 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:dieCornerRadiusis0or would consume the whole diearia-hiddenand carry no pips, so they're purely cosmeticNotes / 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— passesnpm test— 43/43 pass (includes tests for the core rendering only while rolling, sizing, and the skip conditions)🤖 Generated with Claude Code