A film's look (style) and a beat's effect are each one folder. Nothing else names them: python3 slk.py bundle finds them, the tests check them, the gallery shows them, and a film script (film-script.json, which
slk.py make turns into the lesson's default film) or an outline only writes their name (a cheap model spends a few
tokens; a strong model, or you, builds the module once). The default film uses the clean look; another look, and a
storyboard to approve first, come only when the parent asks. Contract: docs/ARCHITECTURE.md §8.10, §8.18, §8.19.
What make picks by itself (tools/slk_filmauto.py, when the script names no style and no effect): the look of
the subject (history museum, arabic notebook, math chalkboard, others clean) and one effect on at most half
the beats, never a question beat: parts_map on the title of a long film, part_banner (or wipe / page_turn) on
each part's first beat, timeline_train on a timeline, heartbeat / walk_trail where the lesson is about the pulse
or moving, ken_burns on a picture-only beat, highlight on a rule's title, stamp on the recap. A new effect that
should join the table: add its rule to auto_pick with a test (tests/test_teach.py). An effect's texts may hold a
word said to the child in both forms, {girl|boy|unknown}: make picks the child's. No effect sound plays under a
recitation or the adhan (hushed), and no effect may draw the Prophet ﷺ, a prophet or an angel.
{"slk":1,"kind":"outline","lesson":"…","style":"museum","beats":[
{"id":"b1","intent":"…","items":[],"effect":"kashida","params":{"word":"الزَّمان"}},
{"id":"b2","intent":"…","items":["a7"],"effect":"push_in"}]}An unknown name or a bad param is dropped with a warning (slk.py film, storyboard and video print it, the app's loader
lists it): the film plays its default look (clean) or the beat plays without an effect. Never a crash.
python3 slk.py card effects lists every module with its params in one line each; site/film.html
(python3 slk.py film-gallery) plays them all.
A look: film/styles/<name>/ (name = [a-z][a-z0-9_]+)
| File | What it holds |
|---|---|
style.json | name (= folder), version, label {ar, fr, en}, about (one line, English, for the cards), palette {bg, ink, accent, muted, card} (#rrggbb), fonts (only the app's fonts — Readex, Baloo, Scheherazade, JetBrains Mono — or system fonts; nothing is downloaded; a film page embeds Baloo when it is named), caption {position: below | over, size: s | m | l}, frame (what the background shows), optional dark: true. Shape: STYLE_SCHEMA in tools/slk_filmkit.py |
style.css | every selector starts with .fs-<name> (the stage) or .fs-<name>-page (the player around it: the caption .fu-cap). Set the variables effects read: --fs-accent, --fs-ink, --fs-muted, --fs-sheet (a page that turns), --fx-chalk, --fx-sheen, --fx-stamp-blend. Light mode: rules under .fs-<name>.fs-light (no shadows, no textures). Textures only as data: URLs or gradients; no @import, no @font-face |
bg.js | optional: SLK.filmStyles.<name>.bg = function (time, ctx) -> html — the background as a pure function of the film's seconds (ctx = {lang, dir, light, w: 1280, h: 720, fx}). Same time → same HTML; a fixed hash, never Math.random; move nothing when ctx.light; quantise time (about 10 steps a second) so the layer is not rewritten every frame |
golden/<case>.json | {about, lesson, beat, t, times, light?}; the tests keep <case>.out.json (the whole stage) |
The stage is drawn in four layers (app/core/filmstage.js): .fs-bg (your background), .fs-board (the
components' slides: .sl, .sl-head, .sl-card, .sl-badge, .sl-title-main…), .fs-band (an effect's own text)
and .fs-over (an effect's overlay). Restyle the shared .sl-* classes; on a dark look, check every component's
slide for contrast (the cards stay light paper).
An effect: film/effects/<name>/
| File | What it holds |
|---|---|
effect.json | name, version, kind (entrance | emphasis | transition | camera), target (text: it draws a text; stage: it moves the board and draws an overlay), window [a, b] (the part of the beat it plays in: p = 0 → 1 between t = a and b), heavy (true when it blurs, turns in 3D or redraws much), label {ar, fr, en}, about, params (a schema: {"type":"object","properties":{…}}, every property with a default; texts with maxLength). Shape: EFFECT_SCHEMA |
effect.js | SLK.filmfx.<name> = function (p, params, ctx) -> {style?, html?, cls?, bg?}: a pure function of p (seek-safe: no timers, no clock, no Math.random; ctx.rng is seeded); params come with their defaults; escape every text with ctx.fx.esc; ctx = {lang, dir, digits, text (target text: the title, the slide's heading, or params.text; its digits already set), parts (a sequence's steps, oldest first), light, seed, t, w, h, fx: the helpers clamp, mix, ease, easeIn, easeInOut, smooth, spring(u, response, damping), settle(p, response, damping, span), n(x, d) (a short number), clusters, words, isArabic, kashida(word, n), stretchable, longest, findWord, hand(rng, w, h, wob), esc, pick(ctx, {ar, fr, en}) — app/core/filmstage.js}. Text target: html replaces the text, style/cls go on its element. Stage target: style on the board, html in the overlay, bg on the background |
effect.json (optional keys) | when (one line: when to use it, shown by card effects), auto: "question" (the film adds it by itself to question beats; see below), sfx (its sounds: [{"at": 0..1 of its window, "sound": whoosh | click | chime | shimmer | pop, "gain"?: dB, "each"?: "second"}]) |
effect.css | optional; every selector starts with .fx-<name> |
golden/<case>.json | {about, lang, text, parts?, params, light?, p?} where p is a list of values 0..1 ([0, 0.5, 1]; default: ten values from 0 to 1); the tests keep <case>.out.json |
Rules the tests check (tests/filmkit.test.mjs, tests/test_filmkit.py):
- Pure:
python3 slk.py bundlereads the code's tokens and refuses the clock, chance, timers, the page and the network in any spelling (Math["random"],performance.now(), a name built from strings in[ ],\uescapes). - Same p → same output, in two fresh contexts; no
NaN/undefined. - p = 1 is the rest: the same for any later p, nothing half shown (no blur, no
opacity:0.…, no hidden letters); an entrance ends on the plain text; a transition leaves nothing. - Escaped: a hostile text or param never reaches the page as markup.
- Light mode (the player's slow-frame switch,
prefers-reduced-motion,?light=1): aheavyeffect is only a fade of its rest (of its start, for a transition) —fxRundoes it; keepheavyhonest. - RTL and LTR: every effect works in Arabic and French. Arabic letters stay joined: never split a word into
several elements; reveal a word whole (a clip from its right edge), or by grapheme cluster (
fx.clusters: a letter with its vowel marks). A kashida goes at a joint (fx.kashida), never inside lam-alef. Timelines run right (oldest) to left in Arabic. "custom"is not a module name: it is kept for beats made by hand (creative mode); the checks pass itsparamsand the beat'scustomobject through untouched, andSLK.film.custom(beat, lesson, ctx, t, opts) -> {bg?, board?, band?, over?}draws it once a script defines it (until then: the beat's plain frame).app/ui/creative.jsdefines it: creative mode (contract §8.11,skills/study-loop/references/creative-film.md) runs a hand-made scene in a sandboxed frame. A scene that proved itself (its words and numbers fromapi.data, the same rules: pure oft, still at the end, Arabic whole) is the best start for a new effect folder here: portscene(t, el, api)toSLK.filmfx.<name>(p, params, ctx), its data toparams, add goldens, and open a pull request.
Then, from the kit folder:
python3 slk.py bundle # regenerate app/filmkit.js (never edit it by hand); bundle --check
SLK_UPDATE_GOLDEN=<name> node tests/run.mjs # write your goldens, then read them
python3 slk.py card effects # read your line as a model will
python3 slk.py film-gallery # site/film.html: see it move next to the others
node tests/run.mjs && python3 -m unittest discover testsQuality bar: light, depth, materials, soft shadows, texture, considered type and timing — not flat clip-art. The
owner's signature effects from the older film pipeline (tools/fx/*.js, tools/motion.js) are a good source of ideas:
springs that settle, presence (enter/exit windows), seeded noise, two-plane camera.
Question beats, sounds and the default background
- Question beats, by themselves. A beat whose last part is a choice, true / false or cloze item gets, after its
narration, 5 s of thinking time (
countdown_ringandyour_turn: «دَوْرُكِ!» / «دَوْرُكَ!» when the player knows the child, else «دَوْري!») and then its answer (answer_reveal, thenstar_reward: a star flies into the counter, which stays on every beat).SLK.film.quizPlan(app/core/filmstage.js; twintools/slk_film.py quiz_plan) picks the beats;compose(…, {quiz, base, stars, hud})draws them in the.fs-quizlayer. It is not a beat effect, so it never counts toward "effects on half the beats"."quiz": falsein the script or outline (or?quiz=0on a film page) turns it off. A beat withpause_card(a mock exam's questions on paper) stops the player at its end. A beat's own"quiz": falsehas no question flow;"quiz": "ask"is a mock exam's question (the item as on paper, the thinking time, no answer):slk.py review <subject>uses both for its exam and its key (contract §8.20). - Sounds.
app/core/filmsfx.js(twintools/slk_sfx.py) synthesises five quiet sounds and places them: a soft whoosh when a beat starts, a shimmer on the opening title, a click each second of a countdown, a chime when a star pops, and what an effect'ssfxlists. Sparse (at most 0.35 cues a second in any 10 s, 1.2 s apart; a countdown counts once) and 11 dB under the narration. The film page plays them (WebAudio, a mute button, none in light mode);slk.py video --mixputs them in the MP4's sound (--no-sfx: without). - The default look moves a little.
cleanhas abg.js: three soft colour fields that drift over 70–110 s, a faint dot pattern and a floor glow; colours by subject (history, science, math, arabic…), turned per part (the beat's skill); still in light mode.
A host (avatar): film/avatars/<name>/
The film's host is a small character beside the board (the owner's films had one: a hoopoe who talks, cheers and
says goodbye). One folder per avatar, like the looks and effects: anyone can add theirs. A film names it at film level,
"host": "<name>" or "host": "none" in film-script.json or the outline; left out, the parent's choice in the app
(Settings → the films' host, kept on the device) decides, then the kit's (app/config.js filmHost), then auto:
the kit's own finch, and no host in maths. python3 slk.py card avatars lists them; site/film.html shows
every pose. Contract: docs/ARCHITECTURE.md §8.18.
What the host does (app/core/filmhost.js, the .fs-host layer): it stands at the end of the reading line (left in
Arabic, right in French) on the back plane, under the board, which shrinks a little toward its reading-start corner
to make room, so it never covers the board's content. Children looked at a talking character instead of the board,
so it is small and still while the board explains (only its mouth moves, with the voice: a recorded clip's own levels,
else the narration's sentences), bigger on the title, points at a book picture, steps up beside the countdown ring at
"your turn", cheers on a star and the recap, waves goodbye at the end. It steps out of a beat with a dense board
(a table, a text, many words) or a stage effect that owns the margin (spotlight, timeline_train, counter…; it stays
with push_in, where it softens with the background, ken_burns and part_banner). It is never an effect: it does not
count toward "effects on half the beats". Light mode: one still pose.
| File | What it holds |
|---|---|
avatar.json | name (= folder; not none or auto), version, label {ar, fr, en}, about (+ about_ar, about_fr), licence {name, credit, url?}, drawing: true (a drawn character, never a photo of a real person), size [w, h] (px, every frame), anchor [x, y] (the feet, 0..1 of the box), faces (left | right: the way the drawing looks; the film mirrors it toward the board), poses {idle (1-2), talk (2-4: mouth a little, more, most open), cheer (1-4), point (1-3: 2nd frame with the mouth open), blink? (1), wave? (1-4)}: lists of files. Shape: AVATAR_SCHEMA in tools/slk_avatars.py |
art/*.svg or art/*.png | one picture per frame, a transparent background, the character only (no text); SVG without scripts, events or links to other files; PNG with alpha, exactly size; ≤ 200 KB each, ≤ 600 KB in all (every film page carries its host's pictures as data: URLs) |
golden/<case>.json | {about, lang, role (title | recap | beat), dur, first?, last?, talk?, env?, text?, point?, quiz?, light?, times}; the tests keep <case>.out.json (the host layer at each second) |
Add yours:
python3 slk.py avatar new owl_pen # film/avatars/owl_pen/: a working starter, bundled, its goldens written
# replace art/*.svg (or use .png) with your drawings and the words of avatar.json (label, about, licence)
python3 slk.py avatar check # the contract, picture by picture
python3 slk.py bundle # app/filmkit.js
SLK_UPDATE_GOLDEN=owl_pen node tests/run.mjs
python3 slk.py film-gallery # site/film.html: its poses and its momentsPictures: draw a character (an animal, a robot, a creature, a person drawn by hand), never a photo of your child or
of anyone; no child's name in it. An avatar is shared with every film and every family, so it carries a licence that
allows it: your own drawing ("own" and your credit), CC0, or CC BY with the author's credit and url.