aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.c
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-19 14:30:28 +0200
committeruser <user@clank>2026-08-19 14:30:28 +0200
commit20e1e104f2254c914b464a147aa0368491cdeb0c (patch)
treeea3d1d0618426f7cdad703ad854b4ce07e06e9b3 /src/app.c
parentslosh: the splash colours glyphs, never backgrounds (diff)
downloadslosh-20e1e104f2254c914b464a147aa0368491cdeb0c.tar.gz
slosh-20e1e104f2254c914b464a147aa0368491cdeb0c.tar.xz
slosh-20e1e104f2254c914b464a147aa0368491cdeb0c.zip
slosh: the logo flies into place -- a particle engine, statelessly
Every non-space glyph of the logo is a particle that flies to its cell over the first two fifths of splash_ms, then *is* the logo for the rest. There is deliberately no particle state anywhere: a position is a pure function of (target, elapsed, seed), recomputed every frame like the layout and the pane states and for the same reason -- physics that is stored can drift, physics that is derived cannot. The seed is the splash timestamp, so every attach flies differently and one splash is coherent frame to frame; a per-particle hash staggers departures, and the delay rescaling lands every straggler exactly at the end, because an almost-assembled logo reads as a bug. Five motions, picked by the clock and pinned by {"cmd":"splash", "motion":N}: rain (fall in, column by column), scatter (converge from everywhere), slide (rows enter from alternating sides), vortex (spiral in around the centre, orbit shrinking and unwinding), shuffle (the glyphs trade places, then sort themselves). The colour chains keep playing over the box throughout, so particles catch their hue as they cross into it. expr_sin() is the expression language's own sine exported for C-side animation: a motion sketched in the repl and one compiled into the binary cannot disagree about what sin(90) is. The tests learned two things the flights taught: the logo's opening run appears three times per line and assembly is staggered, so a middle occurrence can land first -- "assembled" is the row whose first block glyph is where the match begins -- and windows need margins that survive a parallel suite on a busy box.
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/app.c b/src/app.c
index 31f4d69..a9cb37c 100644
--- a/src/app.c
+++ b/src/app.c
@@ -1312,12 +1312,13 @@ bool run_action(app_t *a, action_t act) {
}
}
-void app_splash(app_t *a) { app_splash_fx(a, -1); }
+void app_splash(app_t *a) { app_splash_fx(a, -1, -1); }
-void app_splash_fx(app_t *a, int fx) {
+void app_splash_fx(app_t *a, int fx, int motion) {
if (!CFG.splash_ms) return;
a->splash_until = now_ms_() + CFG.splash_ms;
a->splash_fx = fx;
+ a->splash_motion = motion;
}
void app_event(app_t *a, const input_event_t *ev) {