An AI skill that turns books into animated, narrated, interactive web experiences
JavaScript ai-agentsai-educationanimationclaudeclaude-codeclaude-skillsedtecheducationinteractive-textbookscormtext-to-video
Book cover and chapter contents page, with a way back from every lesson
yzr578ac7fa56b6
diff --git a/.claude/skills/animebook-chapter/SKILL.md b/.claude/skills/animebook-chapter/SKILL.mdindex 60b93bb..4be5c31 100644--- a/.claude/skills/animebook-chapter/SKILL.md+++ b/.claude/skills/animebook-chapter/SKILL.md@@ -62,5 +62,7 @@ description: 为 AnimeBook 制作或修改一章数学动画课:读参考书通用部分在 `site/lib/engine.js` 和 `site/lib/engine.css`:播放器、绘图、题型、角色、画面框架。每章一个 `site/chNN/index.html`,只写 `CHAPTER`、本章的绘图小函数、`BEATS` 和题目数据,最后调用 `boot()`。新章节从 `site/ch02/index.html` 开始改最方便,它展示了算式、面积模型、点阵、数轴跳步等常用写法。+章节页 `<head>` 保留 `<link rel="expect" href="#bar" blocking="render">`:没有它,Chromium 常在播放器生成前就渲染首帧,目录卡片放大成画面的页面过渡会被取消。新章节做好后,在 `site/index.html` 的 `UNITS` 里加一行(标题、分钟数),章号按顺序自动编号;上一章的 `CHAPTER.next` 指向新章。+- 改引擎后,必须重跑所有已完成章节的 `tools/e2e_chNN.py`。- 某个画法第二次用到时,再把它从章节文件挪进引擎,不要提前抽象。diff --git a/.gitignore b/.gitignoreindex f3b6911..5c21116 100644--- a/.gitignore+++ b/.gitignore@@ -5,3 +5,4 @@ __pycache__/# Reference book: internal only, never published. book_pages/ is regenerated from the PDF by split_book.py.book_pages/+.wrangler/diff --git a/CLAUDE.md b/CLAUDE.mdindex 2d7dece..35c4019 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -64,7 +64,7 @@ AnimeBook/│ ├── tts.py # Edge TTS 生成 MP3、词级时间点与逐句字幕│ └── e2e_chNN.py # 各章浏览器端到端检查(Playwright);改引擎后全部重跑├── site/ # 可部署的静态站点(只部署此目录)-│ ├── index.html # 课程目录+│ ├── index.html # 书的封面与章节目录(同一页,hash 切换;章节数据在 UNITS;localStorage 记进度)│ ├── lib/ # 共用引擎:engine.js(播放器、绘图、题型、∞ 角色)、engine.css│ └── chNN/ # 每章一个目录:index.html(本章步骤与题目)、audio/en/(MP3 与 timings.js)├── .venv/ # 现有 PDF 处理工具的 Python 虚拟环境diff --git a/site/ch01/index.html b/site/ch01/index.htmlindex 0ed9037..495268f 100644--- a/site/ch01/index.html+++ b/site/ch01/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Types of Numbers</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch02/index.html b/site/ch02/index.htmlindex e1f2715..b2147d8 100644--- a/site/ch02/index.html+++ b/site/ch02/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Algebraic Properties</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch03/index.html b/site/ch03/index.htmlindex dc333d5..39c824f 100644--- a/site/ch03/index.html+++ b/site/ch03/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Order of Operations</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch04/index.html b/site/ch04/index.htmlindex f65a29d..93aeaa3 100644--- a/site/ch04/index.html+++ b/site/ch04/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Adding Positive and Negative Numbers</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch05/index.html b/site/ch05/index.htmlindex f90511e..9263e15 100644--- a/site/ch05/index.html+++ b/site/ch05/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Subtracting Positive and Negative Numbers</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch06/index.html b/site/ch06/index.htmlindex 5e26345..ef4c2cf 100644--- a/site/ch06/index.html+++ b/site/ch06/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Multiplying and Dividing Positive and Negative Numbers</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch07/index.html b/site/ch07/index.htmlindex d01eff8..fb4c218 100644--- a/site/ch07/index.html+++ b/site/ch07/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Multiplying and Dividing Fractions</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch08/index.html b/site/ch08/index.htmlindex 9682d52..a0daba1 100644--- a/site/ch08/index.html+++ b/site/ch08/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Adding and Subtracting Fractions</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch09/index.html b/site/ch09/index.htmlindex 9d1fadd..ff9a2f5 100644--- a/site/ch09/index.html+++ b/site/ch09/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Adding and Subtracting Decimals</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch10/index.html b/site/ch10/index.htmlindex 3dc804c..b555dd1 100644--- a/site/ch10/index.html+++ b/site/ch10/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Multiplying and Dividing Decimals</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch11/index.html b/site/ch11/index.htmlindex cf05e51..e53a928 100644--- a/site/ch11/index.html+++ b/site/ch11/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Ratio</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch12/index.html b/site/ch12/index.htmlindex e011673..d006808 100644--- a/site/ch12/index.html+++ b/site/ch12/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Unit Rate</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch13/index.html b/site/ch13/index.htmlindex 3195975..4851ab6 100644--- a/site/ch13/index.html+++ b/site/ch13/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Proportion</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch14/index.html b/site/ch14/index.htmlindex 31ada64..08842da 100644--- a/site/ch14/index.html+++ b/site/ch14/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Percent</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch15/index.html b/site/ch15/index.htmlindex c7be4da..ba86b68 100644--- a/site/ch15/index.html+++ b/site/ch15/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Percent Applications</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch16/index.html b/site/ch16/index.htmlindex 52a2562..2af596c 100644--- a/site/ch16/index.html+++ b/site/ch16/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Simple Interest</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch17/index.html b/site/ch17/index.htmlindex 92eacee..ede6c20 100644--- a/site/ch17/index.html+++ b/site/ch17/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Percent Rate of Change</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch18/index.html b/site/ch18/index.htmlindex fa7be48..f0c27f3 100644--- a/site/ch18/index.html+++ b/site/ch18/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Tables and Ratios</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch19/index.html b/site/ch19/index.htmlindex dc0e9a6..9709a4a 100644--- a/site/ch19/index.html+++ b/site/ch19/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Exponents</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch20/index.html b/site/ch20/index.htmlindex c3b21f2..02dcd23 100644--- a/site/ch20/index.html+++ b/site/ch20/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Scientific Notation</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch21/index.html b/site/ch21/index.htmlindex 7d1c81d..c0180b5 100644--- a/site/ch21/index.html+++ b/site/ch21/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Expressions</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch22/index.html b/site/ch22/index.htmlindex 39e59c5..1e9b765 100644--- a/site/ch22/index.html+++ b/site/ch22/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Evaluating Algebraic Expressions</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch23/index.html b/site/ch23/index.htmlindex 86fff31..05cb7ef 100644--- a/site/ch23/index.html+++ b/site/ch23/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Combining Like Terms</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch24/index.html b/site/ch24/index.htmlindex 6215eb8..5a33639 100644--- a/site/ch24/index.html+++ b/site/ch24/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Introduction to Equations</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch25/index.html b/site/ch25/index.htmlindex 66ecabd..ed5d1ad 100644--- a/site/ch25/index.html+++ b/site/ch25/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Solving One-Variable Equations</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch26/index.html b/site/ch26/index.htmlindex 4269c97..6268132 100644--- a/site/ch26/index.html+++ b/site/ch26/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Solving One-Variable Inequalities</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch27/index.html b/site/ch27/index.htmlindex 8a951fd..0b39b3f 100644--- a/site/ch27/index.html+++ b/site/ch27/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Solving Compound Inequalities</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch28/index.html b/site/ch28/index.htmlindex ecf89ac..db4b44a 100644--- a/site/ch28/index.html+++ b/site/ch28/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Rewriting Formulas</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch29/index.html b/site/ch29/index.htmlindex bb3e748..d18f85c 100644--- a/site/ch29/index.html+++ b/site/ch29/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Solving Systems by Substitution</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch30/index.html b/site/ch30/index.htmlindex 80836fd..5069b9d 100644--- a/site/ch30/index.html+++ b/site/ch30/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Solving Systems by Elimination</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch31/index.html b/site/ch31/index.htmlindex b525862..b677ebc 100644--- a/site/ch31/index.html+++ b/site/ch31/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Points and Lines</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch32/index.html b/site/ch32/index.htmlindex 2253189..f13f918 100644--- a/site/ch32/index.html+++ b/site/ch32/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Graphing a Line From a Table</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch33/index.html b/site/ch33/index.htmlindex 998279a..1521662 100644--- a/site/ch33/index.html+++ b/site/ch33/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Slope</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch34/index.html b/site/ch34/index.htmlindex 8e430a2..ef5badc 100644--- a/site/ch34/index.html+++ b/site/ch34/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Slope-Intercept Form</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch35/index.html b/site/ch35/index.htmlindex 1767b41..0650bd5 100644--- a/site/ch35/index.html+++ b/site/ch35/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Point-Slope Form</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch36/index.html b/site/ch36/index.htmlindex 7f98f89..5a624db 100644--- a/site/ch36/index.html+++ b/site/ch36/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Systems by Graphing</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch37/index.html b/site/ch37/index.htmlindex c58c75d..920a67e 100644--- a/site/ch37/index.html+++ b/site/ch37/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Linear Inequalities</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch38/index.html b/site/ch38/index.htmlindex 25821ef..e123e9e 100644--- a/site/ch38/index.html+++ b/site/ch38/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Systems of Inequalities</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/ch39/index.html b/site/ch39/index.htmlindex 982cbb9..ca5fe8a 100644--- a/site/ch39/index.html+++ b/site/ch39/index.html@@ -5,6 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>Introduction to Statistics</title><link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run --></head><body><script src="../lib/engine.js"></script>diff --git a/site/index.html b/site/index.htmlindex 1536b02..ae4437f 100644--- a/site/index.html+++ b/site/index.html@@ -4,87 +4,245 @@<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Pre-Algebra and Algebra, Animated</title>+<link rel="expect" href="#ch01" blocking="render"><style>-:root { --page: #131b18; --board: #1d2b27; --edge: #33473f; --chalk: #ece8dc; --dim: #9aaba3; --accent: #86c9e8;- --ui: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif; color-scheme: dark; }+:root {+ --page: #0f1613; --board: #1d2b27; --panel: #22322d; --edge: #3a5047;+ --chalk: #ece8dc; --dim: #9aaba3; --faint: #5d7068; --task: #f0b45a; --quiz: #86c9e8; --good: #8fd6b0;+ --ui: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;+ --book: "Iowan Old Style", Palatino, Georgia, serif;+ --ease: cubic-bezier(.2, .8, .2, 1);+ color-scheme: dark;+}* { box-sizing: border-box; }-body { margin: 0; background: var(--page); color: var(--chalk); font: 18px/1.5 var(--ui); }-main { max-width: 760px; margin: 0 auto; padding: 56px 16px 80px; }-h1 { margin: 0 0 6px; font-size: 40px; font-weight: 600; }-.lede { margin: 0 0 40px; color: var(--dim); }-h2 { margin: 36px 0 12px; font-size: 16px; font-weight: 600; color: var(--dim); }-ol { list-style: none; margin: 0; padding: 0; }-a { display: flex; gap: 18px; align-items: baseline; padding: 16px 20px; margin-bottom: 8px; border: 1px solid var(--edge); border-radius: 14px;- background: var(--board); color: var(--chalk); text-decoration: none; }-a:hover, a:focus-visible { border-color: var(--accent); outline: none; }-a b { font-weight: 600; color: var(--accent); min-width: 2ch; }-a small { margin-left: auto; color: var(--dim); }+html { scroll-padding-top: 90px; }+body { margin: 0; min-height: 100svh; background: var(--board); color: var(--chalk); font: 18px/1.5 var(--ui); }+/* Chalkboard: the same grain and vignette as the lesson stage. */+body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;+ background: radial-gradient(ellipse at 50% 42%, transparent 55%, rgba(0, 0, 0, .38)),+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .92 0 0 0 0 .95 0 0 0 0 .9 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)'/%3E%3C/svg%3E"); }+a { color: inherit; }+a:focus-visible { outline: 3px solid var(--task); outline-offset: 3px; }+.kicker { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--quiz); }++/* ---------- cover ---------- */+#cover { position: relative; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center;+ padding: 48px 16px 64px; text-align: center; overflow: hidden; }+.open #cover, body:not(.open) #contents { display: none; }+#cover > * { animation: rise .8s var(--ease) backwards; }+#cover .mascot { animation: none; margin-bottom: 26px; view-transition-name: guide; }+#cover .kicker { animation-delay: .9s; }+#cover h1 { animation-delay: 1s; }+#cover .lede { animation-delay: 1.12s; }+#cover .acts { animation-delay: 1.24s; }+#cover .meta { animation-delay: 1.36s; }+h1 { margin: 14px 0 18px; font: 500 clamp(44px, 8.4vw, 92px)/1.02 var(--book); letter-spacing: -.01em; view-transition-name: book; }+h1 i { color: var(--task); font-style: italic; }+.lede { max-width: 34em; margin: 0 0 34px; color: var(--dim); font-size: clamp(17px, 2.2vw, 20px); text-wrap: balance; }+.acts { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }+.btn { display: inline-flex; align-items: center; gap: 12px; padding: 14px 30px; border-radius: 999px; font-weight: 600; font-size: 19px; text-decoration: none;+ transition: transform .25s var(--ease), background-color .25s, border-color .25s; }+.btn[hidden] { display: none; }+.btn:hover { transform: translateY(-2px); }+.btn.go { background: var(--chalk); color: var(--board); }+.btn.quiet { border: 1.5px solid var(--edge); color: var(--chalk); }+.btn.quiet:hover { border-color: var(--dim); }+.btn svg { width: 15px; height: 15px; fill: currentColor; }+.meta { margin: 30px 0 0; color: var(--faint); font-size: 15px; letter-spacing: .04em; }+/* Faint chalk notes around the edges of the board. */+.chalk { position: absolute; inset: 0; z-index: -1; pointer-events: none; animation: none !important; }+.chalk span { position: absolute; font: italic 400 clamp(22px, 3vw, 38px) var(--book); color: var(--chalk); opacity: 0; white-space: nowrap;+ animation: chalk 1.6s ease-out forwards, drift 14s ease-in-out infinite alternate; animation-delay: calc(var(--d) * 1s), calc(var(--d) * 1s); }+@keyframes chalk { to { opacity: .075; } }+@keyframes drift { to { translate: 0 -10px; } }+@keyframes rise { from { opacity: 0; transform: translateY(16px); } }++/* ---------- the guide: an infinity sign whose loops are its eyes ---------- */+.mascot { display: block; overflow: visible; }+.mascot .mbody { transform-box: view-box; transform-origin: 60px 46px; animation: bob 3.4s ease-in-out infinite; }+.mascot .pupil { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }+.mascot .joy { display: none; }+#cover:has(.go:hover, .go:focus-visible) .pupil { display: none; }+#cover:has(.go:hover, .go:focus-visible) .joy { display: inline; }+.draw .loop { stroke-dasharray: 1 1; animation: draw 1.3s cubic-bezier(.6, 0, .3, 1) .15s backwards; }+.draw .face { animation: pop .45s var(--ease) 1.25s backwards; }+@keyframes draw { from { stroke-dashoffset: 1; } }+@keyframes pop { from { opacity: 0; transform: scale(.6); } }+.draw .face { transform-box: view-box; transform-origin: 60px 44px; }+@keyframes bob { 50% { transform: translateY(-3px) rotate(-2deg); } }+@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }++/* ---------- contents ---------- */+.top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 14px; padding: 12px max(16px, calc(50% - 590px));+ background: rgba(22, 33, 29, .86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid #2a3b35; }+.home { display: flex; align-items: center; gap: 12px; text-decoration: none; border-radius: 10px; }+.home .mascot { view-transition-name: guide; }+.home strong { font: 500 22px/1.1 var(--book); view-transition-name: book; }+.home strong i { color: var(--task); }+.prog { margin-left: auto; color: var(--dim); font-size: 15px; white-space: nowrap; }+.prog b { color: var(--good); font-weight: 600; }+main#contents { padding-bottom: 80px; }+.unit { max-width: 1212px; margin: 0 auto; padding: 44px 16px 0; }+.unit h2 { display: flex; align-items: baseline; gap: 14px; margin: 0 0 16px; font: 500 28px/1.2 var(--book); }+.unit h2 span { font: 600 14px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--c); white-space: nowrap; }+.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 12px; }+.ch { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 1fr auto; column-gap: 16px; row-gap: 8px; min-height: 112px;+ padding: 16px 18px 14px 16px; border-radius: 16px; background: var(--panel); border: 1.5px solid var(--edge); border-left: 6px solid var(--c);+ text-decoration: none; transition: transform .3s var(--ease), border-color .3s, box-shadow .3s; }+.ch:hover { transform: translateY(-3px); border-color: var(--c); box-shadow: 0 14px 34px rgba(0, 0, 0, .3); }+.ch b { grid-row: span 2; min-width: 1.15em; font: 500 42px/1 var(--book); color: var(--c); font-variant-numeric: lining-nums tabular-nums; }+.ch span { font-size: 18px; line-height: 1.3; }+.ch small { color: var(--dim); font-size: 14px; }+.ch.done small::before { content: "✓ Finished · "; color: var(--good); font-weight: 600; }+.ch.last small::after { content: " · Last opened"; color: var(--quiz); }+.ch.here:focus-visible { outline-color: var(--c); }+.ch.here { animation: here 1.8s ease-out .3s; }+@keyframes here { 0% { box-shadow: 0 0 0 0 var(--c); } 25% { box-shadow: 0 0 0 5px var(--c); } 100% { box-shadow: 0 0 0 14px transparent; } }+.stagger .top { animation: rise .6s var(--ease) backwards; }+.stagger .unit h2, .stagger .ch { animation: rise .6s var(--ease) backwards; animation-delay: calc(min(var(--i), 14) * 32ms + 80ms); }++/* ---------- page-to-page motion ---------- */+@view-transition { navigation: auto; }+::view-transition-group(*) { animation-duration: .5s; animation-timing-function: var(--ease); }+::view-transition-old(lesson), ::view-transition-new(lesson) { height: 100%; object-fit: cover; }+::view-transition-old(lesson) { animation-duration: .18s; }+@media (max-width: 560px) {+ .home strong { font-size: 18px; }+ .ch { min-height: 0; }+ .chalk span:not(:nth-child(3), :nth-child(4), :nth-child(7)) { display: none; }+}+@media (prefers-reduced-motion: reduce) {+ *, *::before, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; }+ .chalk span { opacity: .075; }+}</style></head><body>-<main>- <h1>Pre-Algebra and Algebra, Animated</h1>- <p class="lede">Short animated lessons with sound, quick checks along the way, and practice at the end of each chapter.</p>- <h2>Unit 1: Arithmetic properties</h2>- <ol>- <li><a href="ch01/"><b>1</b> Types of numbers <small>8 min</small></a></li>- <li><a href="ch02/"><b>2</b> Algebraic properties <small>9 min</small></a></li>- <li><a href="ch03/"><b>3</b> Order of operations <small>7 min</small></a></li>- </ol>- <h2>Unit 2: The number system</h2>- <ol>- <li><a href="ch04/"><b>4</b> Adding positive and negative numbers <small>7 min</small></a></li>- <li><a href="ch05/"><b>5</b> Subtracting positive and negative numbers <small>6 min</small></a></li>- <li><a href="ch06/"><b>6</b> Multiplying and dividing positive and negative numbers <small>6 min</small></a></li>- <li><a href="ch07/"><b>7</b> Multiplying and dividing fractions <small>7 min</small></a></li>- <li><a href="ch08/"><b>8</b> Adding and subtracting fractions <small>7 min</small></a></li>- <li><a href="ch09/"><b>9</b> Adding and subtracting decimals <small>7 min</small></a></li>- <li><a href="ch10/"><b>10</b> Multiplying and dividing decimals <small>7 min</small></a></li>- </ol>- <h2>Unit 3: Ratios, proportions, and percents</h2>- <ol>- <li><a href="ch11/"><b>11</b> Ratio <small>6 min</small></a></li>- <li><a href="ch12/"><b>12</b> Unit rate <small>5 min</small></a></li>- <li><a href="ch13/"><b>13</b> Proportion <small>6 min</small></a></li>- <li><a href="ch14/"><b>14</b> Percent <small>7 min</small></a></li>- <li><a href="ch15/"><b>15</b> Percent applications <small>7 min</small></a></li>- <li><a href="ch16/"><b>16</b> Simple interest <small>6 min</small></a></li>- <li><a href="ch17/"><b>17</b> Percent rate of change <small>5 min</small></a></li>- <li><a href="ch18/"><b>18</b> Tables and ratios <small>5 min</small></a></li>- </ol>- <h2>Unit 4: Exponents and algebraic expressions</h2>- <ol>- <li><a href="ch19/"><b>19</b> Exponents <small>6 min</small></a></li>- <li><a href="ch20/"><b>20</b> Scientific notation <small>6 min</small></a></li>- <li><a href="ch21/"><b>21</b> Expressions <small>6 min</small></a></li>- <li><a href="ch22/"><b>22</b> Evaluating algebraic expressions <small>6 min</small></a></li>- <li><a href="ch23/"><b>23</b> Combining like terms <small>6 min</small></a></li>- </ol>- <h2>Unit 5: Linear equations and inequalities</h2>- <ol>- <li><a href="ch24/"><b>24</b> Introduction to equations <small>6 min</small></a></li>- <li><a href="ch25/"><b>25</b> Solving one-variable equations <small>7 min</small></a></li>- <li><a href="ch26/"><b>26</b> Solving one-variable inequalities <small>7 min</small></a></li>- <li><a href="ch27/"><b>27</b> Solving compound inequalities <small>7 min</small></a></li>- <li><a href="ch28/"><b>28</b> Rewriting formulas <small>5 min</small></a></li>- <li><a href="ch29/"><b>29</b> Solving systems by substitution <small>7 min</small></a></li>- <li><a href="ch30/"><b>30</b> Solving systems by elimination <small>6 min</small></a></li>- </ol>- <h2>Unit 6: Graphing linear equations and inequalities</h2>- <ol>- <li><a href="ch31/"><b>31</b> Points and lines <small>5 min</small></a></li>- <li><a href="ch32/"><b>32</b> Graphing a line from a table <small>5 min</small></a></li>- <li><a href="ch33/"><b>33</b> Slope <small>5 min</small></a></li>- <li><a href="ch34/"><b>34</b> Slope-intercept form <small>6 min</small></a></li>- <li><a href="ch35/"><b>35</b> Point-slope form <small>7 min</small></a></li>- <li><a href="ch36/"><b>36</b> Solving systems by graphing <small>6 min</small></a></li>- <li><a href="ch37/"><b>37</b> Graphing linear inequalities <small>6 min</small></a></li>- <li><a href="ch38/"><b>38</b> Systems of inequalities by graphing <small>6 min</small></a></li>- </ol>- <h2>Unit 7: Statistics and probability</h2>- <ol>- <li><a href="ch39/"><b>39</b> Introduction to statistics <small>6 min</small></a></li>- </ol>+<section id="cover">+ <div class="chalk" aria-hidden="true">+ <span style="left:7%;top:13%;--d:1.6">a + b = b + a</span>+ <span style="right:8%;top:17%;--d:1.9">y = mx + b</span>+ <span style="left:5%;bottom:20%;--d:2.2">|−7| = 7</span>+ <span style="right:6%;bottom:15%;--d:2.5">x² − 9 = 0</span>+ <span style="left:24%;top:4%;--d:2.8">¾ = 0.75</span>+ <span style="right:24%;bottom:5%;--d:3.1">3(x + 2)</span>+ <span style="left:16%;bottom:6%;--d:3.4">−2 < x ≤ 5</span>+ </div>+ <svg class="mascot draw" id="guide" width="210" height="147"></svg>+ <p class="kicker">An animated workbook</p>+ <h1>Pre-Algebra <i>&</i> Algebra</h1>+ <p class="lede">Lessons drawn and narrated step by step, quick checks inside the picture, and practice at the end of every chapter.</p>+ <div class="acts">+ <a class="btn go" href="#contents">Open the book<svg viewBox="0 0 16 16"><path d="M6 2.5 11.5 8 6 13.5 4.6 12.1 8.7 8 4.6 3.9z"/></svg></a>+ <a class="btn quiet" id="resume" hidden></a>+ </div>+ <p class="meta" id="meta"></p>+</section>++<main id="contents">+ <header class="top">+ <a class="home" href="#" aria-label="Back to the cover"><svg class="mascot" id="guideSmall" width="52" height="36"></svg><strong>Pre-Algebra <i>&</i> Algebra</strong></a>+ <span class="prog" id="prog"></span>+ </header>+ <div id="units"></div></main>++<script>+'use strict';+// Chapters are numbered in order through the units. Add a chapter here when its lesson is ready.+const UNITS = [+ ['Arithmetic properties', [['Types of numbers', 8], ['Algebraic properties', 9], ['Order of operations', 7]]],+ ['The number system', [['Adding positive and negative numbers', 7], ['Subtracting positive and negative numbers', 6],+ ['Multiplying and dividing positive and negative numbers', 6], ['Multiplying and dividing fractions', 7], ['Adding and subtracting fractions', 7],+ ['Adding and subtracting decimals', 7], ['Multiplying and dividing decimals', 7]]],+ ['Ratios, proportions, and percents', [['Ratio', 6], ['Unit rate', 5], ['Proportion', 6], ['Percent', 7], ['Percent applications', 7],+ ['Simple interest', 6], ['Percent rate of change', 5], ['Tables and ratios', 5]]],+ ['Exponents and algebraic expressions', [['Exponents', 6], ['Scientific notation', 6], ['Expressions', 6], ['Evaluating algebraic expressions', 6],+ ['Combining like terms', 6]]],+ ['Linear equations and inequalities', [['Introduction to equations', 6], ['Solving one-variable equations', 7], ['Solving one-variable inequalities', 7],+ ['Solving compound inequalities', 7], ['Rewriting formulas', 5], ['Solving systems by substitution', 7], ['Solving systems by elimination', 6]]],+ ['Graphing linear equations and inequalities', [['Points and lines', 5], ['Graphing a line from a table', 5], ['Slope', 5], ['Slope-intercept form', 6],+ ['Point-slope form', 7], ['Solving systems by graphing', 6], ['Graphing linear inequalities', 6], ['Systems of inequalities by graphing', 6]]],+ ['Statistics and probability', [['Introduction to statistics', 6]]],+];+const HUES = ['#f4a48c', '#86c9e8', '#f3c95c', '#e8a0c8', '#8fd6b0', '#bba8ee', '#f0b45a'];+const id = n => 'ch' + String(n).padStart(2, '0');+let P = {};+try { P = JSON.parse(localStorage.getItem('progress') || '{}'); } catch {}+const done = new Set(P.done || []);++// Contents.+let n = 0, total = 0, i = 0; // i staggers the entrance, in reading order+const esc = s => s.replace(/&/g, '&').replace(/</g, '<');+document.getElementById('units').innerHTML = UNITS.map(([name, chs], u) => {+ return `<section class="unit" style="--c:${HUES[u % HUES.length]};--i:${i++}"><h2><span>Unit ${u + 1}</span>${esc(name)}</h2><div class="grid">` ++ chs.map(([t, min]) => { n++;+ const cls = 'ch' + (done.has(n) ? ' done' : '') + (P.last === n ? ' last' : '');+ return `<a class="${cls}" id="${id(n)}" href="${id(n)}/" style="--i:${i++}"><b>${n}</b><span>${esc(t)}</span><small>${min} min</small></a>`;+ }).join('') + '</div></section>';+}).join('');+total = n;+const finished = [...done].filter(k => k <= total).length;+document.getElementById('prog').innerHTML = finished ? `<b>${finished}</b> of ${total} finished` : `${total} chapters`;+document.getElementById('meta').textContent = `${total} chapters · ${UNITS.length} units · with sound`;+const last = P.last && document.getElementById(id(P.last));+if (last) {+ const r = document.getElementById('resume');+ r.hidden = false;+ r.href = last.getAttribute('href');+ r.textContent = `Continue · Chapter ${P.last}`;+}++// The guide, drawn the same way as in the lessons.+function lemniscate(cx, cy, a, k) {+ let d = '';+ for (let i = 0; i <= 96; i++) {+ const t = i / 96 * 2 * Math.PI, sn = Math.sin(t), q = 1 + sn * sn;+ d += (i ? 'L' : 'M') + (cx + a * Math.cos(t) / q).toFixed(1) + ' ' + (cy + k * a * sn * Math.cos(t) / q).toFixed(1);+ }+ return d + 'Z';+}+for (const svg of document.querySelectorAll('svg.mascot')) {+ svg.setAttribute('viewBox', '0 0 120 84');+ svg.setAttribute('aria-hidden', 'true');+ const ln = 'fill="none" stroke="#ece8dc" stroke-linecap="round" stroke-linejoin="round"';+ svg.innerHTML = `<g class="mbody"><path class="loop" pathLength="1" d="${lemniscate(60, 40, 52, 1.5)}" ${ln} stroke-width="6"/><g class="face">` ++ [33, 87].map(x => `<circle class="pupil" cx="${x}" cy="40" r="6.5" fill="#ece8dc"/><path class="joy" d="M${x - 7} 43Q${x} 32 ${x + 7} 43" ${ln} stroke-width="4"/>`).join('') ++ `<path d="M55 62Q60 67 65 62" ${ln} stroke-width="3.5"/></g></g>`;+}++// Cover and contents share this page: an empty hash shows the cover, any other hash the contents.+// Lessons link back with #chNN, so the reader lands on the chapter they just left.+const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;+function show(animate) {+ const open = location.hash.length > 1;+ const apply = () => {+ document.body.classList.toggle('open', open);+ document.body.classList.toggle('stagger', animate && open);+ const here = open ? document.getElementById(location.hash.slice(1)) : null;+ document.querySelectorAll('.here').forEach(e => e.classList.remove('here'));+ if (here?.classList.contains('ch')) { here.scrollIntoView({ block: 'center' }); here.classList.add('here'); }+ else scrollTo(0, 0);+ };+ if (animate && document.startViewTransition && !reduced) document.startViewTransition(apply).ready.catch(() => {}); // an interrupted transition just ends+ else apply();+}+addEventListener('hashchange', () => show(true));+show(false);++// Between pages, the chosen card grows into the lesson frame and the frame shrinks back into its card.+let named = null;+const name = el => {+ if (named) named.style.viewTransitionName = '';+ named = el;+ if (el) el.style.viewTransitionName = 'lesson';+};+document.addEventListener('click', e => { const a = e.target.closest('a[href^="ch"]'); if (a) name(a); });+addEventListener('pagereveal', e => {+ const target = (location.hash.length > 1 && document.getElementById(location.hash.slice(1))?.closest('.ch')) || (named?.offsetParent && named);+ name(e.viewTransition && target ? target : null);+ e.viewTransition?.finished.then(() => name(null), () => name(null));+});+</script></body></html>diff --git a/site/lib/engine.css b/site/lib/engine.cssindex 973334d..32acb76 100644--- a/site/lib/engine.css+++ b/site/lib/engine.css@@ -21,8 +21,16 @@ button[hidden] { display: none; }.cover { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; display: grid; place-items: center; background: rgba(15, 22, 19, .5); border: 0; }.cover[hidden] { display: none; }-.cover span { display: inline-flex; align-items: center; gap: 16px; padding: 20px 40px; border-radius: 999px; background: var(--chalk); color: var(--board); font-weight: 600; font-size: 32px; }-.cover small { display: block; margin-top: 16px; font-size: 22px; text-align: center; color: var(--chalk); }+.cover > div { display: flex; flex-direction: column; align-items: center; }+.cover-k { margin: 0 0 10px; text-align: center; font-size: 22px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--quiz); }+.cover-t { margin: 0 0 44px; max-width: 1200px; text-align: center; font: 500 64px/1.15 "Iowan Old Style", Palatino, Georgia, serif; color: var(--chalk); text-wrap: balance; }+.cover > div > * { animation: rise .7s cubic-bezier(.2, .8, .2, 1) backwards; }+.cover-t { animation-delay: .08s; }+.cover .go { animation-delay: .18s; }+.cover small { animation-delay: .26s; }+@keyframes rise { from { opacity: 0; transform: translateY(14px); } }+.cover .go { display: inline-flex; align-items: center; gap: 16px; padding: 20px 40px; border-radius: 999px; background: var(--chalk); color: var(--board); font-weight: 600; font-size: 32px; }+.cover small { display: block; margin-top: 22px; font-size: 22px; text-align: center; color: var(--dim); }.paused-mark { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; display: none; place-items: center; pointer-events: none; }.paused .paused-mark { display: grid; }.paused-mark div { padding: 14px 30px; border-radius: 999px; background: rgba(15, 22, 19, .85); color: var(--dim); font-size: 22px; }@@ -187,3 +195,16 @@ svg.m { display: inline-block; overflow: visible; }@keyframes hop { 40% { transform: translateY(-12px) rotate(4deg); } }@keyframes wobble { 25% { transform: rotate(-8deg); } 75% { transform: rotate(6deg); } }@media (prefers-reduced-motion: reduce) { .card, .fb, .opt, .grid .mark, .mascot * { animation: none !important; } }++a.icon { text-decoration: none; }+a.btn { text-decoration: none; display: inline-block; }+/* Page-to-page motion: the contents card grows into this frame, and shrinks back on the way out. */+@view-transition { navigation: auto; }+#frame { view-transition-name: lesson; }+::view-transition-group(lesson) { animation-duration: .5s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }+::view-transition-old(lesson), ::view-transition-new(lesson) { height: 100%; object-fit: cover; }+::view-transition-old(lesson) { animation-duration: .18s; }+@media (prefers-reduced-motion: reduce) { .cover > div > * { animation: none; } ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }+/* The finish screen speaks the same type as the chapter cover and the contents page. */+.fin .kicker { font-size: 20px; letter-spacing: .14em; text-transform: uppercase; }+.fin .prompt { margin: 6px 0 14px; font: 500 56px/1.15 "Iowan Old Style", Palatino, Georgia, serif; }diff --git a/site/lib/engine.js b/site/lib/engine.jsindex 02493e7..d5355c6 100644--- a/site/lib/engine.js+++ b/site/lib/engine.js@@ -49,10 +49,15 @@ document.body.insertAdjacentHTML('afterbegin', `<div id="frame"></div><p class="sound-note" id="soundNote" hidden>Sound could not play. The lesson continues with the on-screen text.</p><button class="cover" id="cover"><div>- <span><svg width="24" height="24" viewBox="0 0 18 18"><path d="M3 1.5v15l13-7.5z" fill="currentColor"/></svg>Start lesson</span>+ <p class="cover-k" id="coverK"></p>+ <h1 class="cover-t" id="coverT"></h1>+ <span class="go"><svg width="24" height="24" viewBox="0 0 18 18"><path d="M3 1.5v15l13-7.5z" fill="currentColor"/></svg>Start lesson</span><small><span id="coverMeta"></span> Press <kbd>Space</kbd> to start, <kbd>?</kbd> for shortcuts.</small></div></button><div id="bar">+ <a class="icon" id="bHome" href="../" aria-label="All chapters" title="All chapters">+ <svg viewBox="0 0 18 18"><path d="M2 2h6v6H2zM10 2h6v6h-6zM2 10h6v6H2zM10 10h6v6h-6z"/></svg>+ </a><button class="icon" id="bPlay" aria-label="Play or pause (space)"><svg class="i-play" viewBox="0 0 18 18"><path d="M4 2v14l12-7z"/></svg><svg class="i-pause" viewBox="0 0 18 18"><path d="M3.5 2h4v14h-4zM10.5 2h4v14h-4z"/></svg>@@ -724,6 +729,9 @@ function finishCard() {const c = card(SCREEN, 'fin');const sum = pre => Object.entries(SCORE).filter(([k]) => k.startsWith(pre)).reduce((a, [, v]) => [a[0] + v.right, a[1] + v.total], [0, 0]);const line = (name, [r, t]) => h('p', 'fb', t ? `${name}: ${r} of ${t} right on the first try.` : `${name}: not attempted.`);+ progress(p => { p.done = [...new Set([...(p.done || []), CHAPTER.number])]; });+ const home = h('a', 'btn quiet', 'All chapters');+ home.href = $('bHome').href;const again = h('button', 'btn' + (CHAPTER.next ? ' quiet' : ' go'), ['Watch again', kbd(CHAPTER.next ? 'R' : 'Enter')]);again.onclick = restart;const next = CHAPTER.next && h('button', 'btn go', ['Next chapter', kbd('Enter')]);@@ -732,7 +740,7 @@ function finishCard() {: (e.key === 'r' || e.key === 'R') ? (restart(), true) : false;const guide = mascotEl(240);c.append(h('div', 'finwrap', [guide, h('p', 'kicker', `Chapter ${CHAPTER.number} complete`), h('p', 'prompt', CHAPTER.title),- line('Quick checks', sum('c-')), line('Chapter practice', sum('p-')), h('div', 'acts', next ? [again, next] : [again])]));+ line('Quick checks', sum('c-')), line('Chapter practice', sum('p-')), h('div', 'acts', next ? [home, again, next] : [home, again])]));setTimeout(() => mood(guide, 'happy'), 400);}@@ -1377,7 +1385,15 @@ fit();// Start the lesson once the chapter page has defined CHAPTER and BEATS.// ?beat=N&t=S opens a paused frame, for reviewing a single moment.+// Per-browser progress shared with the contents page: last chapter opened, chapters finished.+function progress(f) {+ try { const p = JSON.parse(localStorage.getItem('progress') || '{}'); f(p); localStorage.setItem('progress', JSON.stringify(p)); } catch {}+}function boot() {+ $('coverK').textContent = `Chapter ${CHAPTER.number}`;+ $('coverT').textContent = CHAPTER.title;+ $('bHome').href = `../#ch${String(CHAPTER.number).padStart(2, '0')}`;+ progress(p => { p.last = CHAPTER.number; });document.getElementById('stage').setAttribute('aria-label', `Lesson animation: ${CHAPTER.title}`);$('coverMeta').textContent = `About ${CHAPTER.minutes} minutes, with sound and quick checks.`;buildSegs();