Skip to content

fix(background): make pixel_grid's twinkle reach both ends of the range - #206

Merged
LeadcodeDev merged 1 commit into
mainfrom
fix/pixel-grid-twinkle-full-range
Aug 12, 2026
Merged

fix(background): make pixel_grid's twinkle reach both ends of the range#206
LeadcodeDev merged 1 commit into
mainfrom
fix/pixel-grid-twinkle-full-range

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

What

pixel_grid's twinkle oscillated the cell alpha over 0.10..1.00, so a cell never went out. A lattice whose cells only dip to a tenth still reads as a fixed field of permanent dots — just dimmer — which is not what an animated texture is for.

- let a = 0.55 + 0.45 * (t * 1.6 + phase).sin();   // 0.10 .. 1.00
+ let a = 0.5  + 0.5  * (t * 1.6 + phase).sin();   // 0.00 .. 1.00

The phase still comes from each cell's own hash, or the whole field blinks in unison.

Test

It pins the range, not the fact that something moves: 400 sampled instants, floor under 0.01, ceiling over 0.99. "It animates" and "it reaches zero" are different claims, and only the second one was asked for.

Note

This should have shipped with #205 — I said it had, and it had not: the change was still uncommitted in my working tree when that branch was pushed. Caught by a git diff when the branch refused to switch.

cargo test --workspace green, cargo fmt --check and cargo clippy --all-targets -- -D warnings clean.

The cell alpha oscillated over 0.10..1.00, so a cell never actually went out.
A lattice whose cells only dip to a tenth still reads as a fixed field of
permanent dots, just dimmer — which is not what an animated texture is for.

0.5 + 0.5 * sin gives the full 0 → 1 → 0. The phase still comes from each
cell's own hash, or the whole field blinks in unison.

The test pins the range rather than the fact that something moves: it samples
400 instants and asserts the floor goes under 0.01 and the ceiling over 0.99.
"It animates" and "it reaches zero" are different claims.
@LeadcodeDev LeadcodeDev added the bug Something isn't working label Aug 12, 2026
@LeadcodeDev LeadcodeDev self-assigned this Aug 12, 2026
@LeadcodeDev
LeadcodeDev merged commit 117d45e into main Aug 12, 2026
3 checks passed
@LeadcodeDev
LeadcodeDev deleted the fix/pixel-grid-twinkle-full-range branch August 12, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant