Skip to content

Commit 0223b97

Browse files
Gustav-SimonssonTheGreatAxios
authored andcommitted
refactor(tui): deepen comment compression in the mark animation module
1 parent 606b352 commit 0223b97

1 file changed

Lines changed: 19 additions & 25 deletions

File tree

‎src/tui/mark-anim.ts‎

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
/**
2-
* The animated Corbits mark (ported from the web boot screen): the
3-
* silhouette draws solid, revealed left to right by `drawProg` and filled
4-
* bottom-up by `fillProg`. The web build dithers; at hero size a terminal
5-
* renders dithering as noise, so the mark is opaque. Pixel snow falls over
6-
* sky cells on the injected clock; mountain cells always win over flakes.
7-
* `still` / `reducedMotion` semantics live on the MarkInput fields.
2+
* The animated Corbits mark (ported from the web boot screen). The web
3+
* build dithers; at hero size a terminal renders dithering as noise, so
4+
* the mark is opaque. Pixel snow falls over sky cells on the injected
5+
* clock; mountain cells always win over flakes.
86
*/
97

108
import { MARK_SMALL, type MarkGrid } from "./mark-shape.js";
@@ -36,8 +34,8 @@ export interface MarkFrame {
3634
}
3735

3836
/**
39-
* The looping timeline: draw in (0-38%), hold (38-48%), fill bottom-up
40-
* (48-76%), hold full (76-90%), fade out (90-100%), repeat.
37+
* The looping timeline: draw (0-38%), hold (38-48%), fill (48-76%),
38+
* hold full (76-90%), fade (90-100%), repeat.
4139
*/
4240
export function markFrame(seconds: number, still: boolean): MarkFrame {
4341
if (still) return { drawProg: 1, fillProg: 1, alpha: 1 };
@@ -58,10 +56,9 @@ export function markFrame(seconds: number, still: boolean): MarkFrame {
5856
const EIGHTHS = ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"] as const;
5957

6058
/**
61-
* Exponent applied to filled coverage. The mark is a thin ridgeline, so
62-
* most cells it touches are only partly covered; the gamma lifts them into
63-
* one solid body while the sparsest edge cells stay short enough to keep
64-
* the slope.
59+
* Exponent on filled coverage: the mark is a thin ridgeline, so most cells
60+
* it touches are only partly covered; the gamma lifts them into one solid
61+
* body while the sparsest edge cells keep the slope.
6562
*/
6663
const FILL_GAMMA = 0.6;
6764

@@ -103,8 +100,8 @@ function unitHash(a: number, b = 0): number {
103100
}
104101

105102
/**
106-
* Whether a sky cell holds a flake at `seconds`. Sparse columns only, each
107-
* with one flake on a private phase and slight speed variation, so the
103+
* Whether a sky cell holds a flake at `seconds`. Sparse columns only, one
104+
* flake per column on a private phase with slight speed variation, so the
108105
* field does not march as a rigid lattice.
109106
*/
110107
function snowflakeAt(
@@ -122,15 +119,12 @@ function snowflakeAt(
122119
}
123120

124121
/**
125-
* Composite one frame into a row-major cell grid.
122+
* Composite one frame. The silhouette is drawn solid: a fully covered cell
123+
* is `█`, a partly covered one is the eighth block matching its coverage,
124+
* so the ridgeline slopes instead of staircasing.
126125
*
127-
* The silhouette is drawn solid: a fully covered cell is `█`, a partly
128-
* covered one is the eighth block matching its coverage, so the ridgeline
129-
* slopes instead of staircasing. Flakes never overwrite mountain coverage;
130-
* `snowOn` below gates them (see the MarkInput field docs).
131-
*
132-
* `alpha` has no terminal equivalent, so it scales the block height instead:
133-
* the mark sinks toward empty rather than blending to black.
126+
* `alpha` has no terminal equivalent, so it scales the block height: the
127+
* mark sinks toward empty rather than blending to black.
134128
*/
135129
export function renderMark(input: MarkInput): readonly (readonly MarkCell[])[] {
136130
const shape = input.grid ?? MARK_SMALL;
@@ -182,9 +176,9 @@ export function renderMark(input: MarkInput): readonly (readonly MarkCell[])[] {
182176
}
183177

184178
/**
185-
* The row the fill is crossing. Interior cells change too little between
186-
* outline and filled to show the sweep, so the crossing row is drawn at the
187-
* fill's own height — capped by the cell to keep the wipe inside the
179+
* The row the fill is crossing: interior cells change too little between
180+
* outline and filled to show the sweep, so the crossing row draws at the
181+
* fill's own height, capped by the cell to keep the wipe inside the
188182
* silhouette.
189183
*/
190184
function fillEdgeChar(rowFill: number, height: number): string | null {

0 commit comments

Comments
 (0)