aboutsummaryrefslogtreecommitdiffstats
path: root/include
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 /include
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 'include')
-rw-r--r--include/app.h10
-rw-r--r--include/app_internal.h6
-rw-r--r--include/expr.h4
3 files changed, 14 insertions, 6 deletions
diff --git a/include/app.h b/include/app.h
index 381c3c0..33fcbea 100644
--- a/include/app.h
+++ b/include/app.h
@@ -66,11 +66,13 @@ size_t app_fds(app_t *a, int *out, size_t max);
void app_reap(app_t *a);
void app_compose(app_t *a, screen_t *s);
-/* Show the logo splash for splash_ms, centered over everything, wearing a
- * different shader effect each time. Called on attach; any input ends it.
- * app_splash_fx picks the effect by index (wrapped); -1 lets the clock. */
+/* Show the logo splash for splash_ms, centered over everything: the glyphs
+ * fly into place first (a particle motion), then a colour effect plays over
+ * them. Both are picked by the clock each time; app_splash_fx pins either by
+ * index (wrapped), -1 to leave a pick to the clock. Called on attach; any
+ * input ends it. */
void app_splash(app_t *a);
-void app_splash_fx(app_t *a, int fx);
+void app_splash_fx(app_t *a, int fx, int motion);
/* Bytes straight into the focused pane's pty (the harness's `raw`). */
void app_write_focused(app_t *a, const void *buf, size_t len);
bool app_should_quit(const app_t *a);
diff --git a/include/app_internal.h b/include/app_internal.h
index 9af6a04..b3a64cb 100644
--- a/include/app_internal.h
+++ b/include/app_internal.h
@@ -264,10 +264,12 @@ struct app {
/* The logo splash: shown until this instant, 0 for not at all. Set when a
* client attaches (app_splash), ended early by any key or click. The
- * timestamp doubles as the seed that picks which effect this one wears,
- * unless splash_fx (>= 0, from the control API) already chose. */
+ * timestamp doubles as the seed that picks the colour effect and the
+ * particle motion this one wears, unless splash_fx / splash_motion (>= 0,
+ * from the control API) already chose. */
int64_t splash_until;
int splash_fx;
+ int splash_motion;
};
/* One config per process, owned by app.c (ensure_config/app_reload_config
diff --git a/include/expr.h b/include/expr.h
index d593319..28eeabc 100644
--- a/include/expr.h
+++ b/include/expr.h
@@ -93,6 +93,10 @@ int expr_eval(const expr_prog_t *p, const expr_env_t *env);
* pretend an expression was a number. */
const char *expr_source(const expr_prog_t *p);
+/* The language's sine, for C code that animates: degrees in (any angle
+ * wraps), -255..255 out -- the same table `sin()` in an expression uses. */
+int expr_sin(int deg);
+
/* Evaluate for every cell of a cols x rows rect into `out` (cols*rows bytes,
* clamped to 0..255), reusing the last result when nothing it reads has
* changed. Returns false when the program reads the clock, which is the one