An AI skill that turns books into animated, narrated, interactive web experiences
JavaScript ai-agentsai-educationanimationclaudeclaude-codeclaude-skillsedtecheducationinteractive-textbookscormtext-to-video
feat: add Math Notebook to bookshelf
yzra7531690a0ab
diff --git a/.gitignore b/.gitignoreindex 5c21116..cadce9f 100644--- a/.gitignore+++ b/.gitignore@@ -6,3 +6,6 @@ __pycache__/book_pages/.wrangler/++# Extracted references for books in their own folders.+books/*/pages/diff --git a/CLAUDE.md b/CLAUDE.mdindex 1f5c9e1..87bb446 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -5,6 +5,7 @@## 当前方向+- 网站已收录两本书:第一本 68 章;第二本 Math Notebook 的前三章从 Book2 合并。第二本的约定与进度在 `books/math-notebook/`,后续章节因 API 成本暂停,需用户授权后再制作。- 以参考书为基础重新创作数学动画练习册,先做第一章实验。- 成品是尽量轻量、自包含的静态站点,无应用后端和数据库。- 数学教学动画是核心。用户已验证纯 JS 动画的可行性,允许实现 agent 自行处理动画细节;技术栈尚未选定。@@ -57,14 +58,18 @@ AnimeBook/├── scripts/│ └── prepare_mascot.swift # 在 macOS 上生成透明 PNG 和 SVG 封装├── content/chNN/ # 每章英文讲稿 narration.en.json([[mark]] 标记动画触发词)及 tts 缓存+├── books/math-notebook/ # 第二本:BOOK.md、chapters.md、章节分镜与 sections.json;PDF 和 pages/ 为本地参考,不入 Git+├── content/math-notebook/ # 第二本前三章讲稿与语音时间点├── .claude/skills/animebook/ # 从 PDF 到互动动画书的流程(英文):拆书、规划、初始化、试点、逐章制作、轻量交付检查、目录与发布;│ # scripts/(outline、split_pages、tts、shot、check_blank)、assets/(引擎与模板)、references/├── tools/-│ └── e2e_chNN.py # 当前数学书的浏览器端到端检查;播放器或判题变化时运行相关检查+│ ├── e2e_chNN.py # 当前数学书的浏览器端到端检查;播放器或判题变化时运行相关检查+│ └── math-notebook/ # 第二本:smoke_ch01–ch03.py 与 register.py├── site/ # 可部署的静态站点(只部署此目录)│ ├── index.html # 书架、书封与章节目录(同一页,hash 切换;章节数据在 UNITS;localStorage 记进度)│ ├── lib/ # 共用引擎 engine.js / engine.css;书架数据与样式 bookshelf.js / bookshelf.css;目录页单元小图 unit-art.js-│ └── chNN/ # ch01–ch68 每章一个目录:index.html(本章步骤与题目)、audio/en/(MP3 与 timings.js)+│ ├── chNN/ # ch01–ch68 每章一个目录:index.html(本章步骤与题目)、audio/en/(MP3 与 timings.js)+│ └── math-notebook/ # 第二本:封面与目录、独立 lib/ 引擎、unit-art.js、ch01–ch03 与现有 MP3├── .git/ # 本地 Git 仓库,尚未配置远程└── .DS_Store # macOS 自动生成的目录信息```diff --git a/README.md b/README.mdindex 15ad8a3..b5ecef3 100644--- a/README.md+++ b/README.md@@ -1,9 +1,14 @@# AnimeBook-把一本书(PDF)做成带动画、语音和互动练习的网页书。第一本是 *Pre-Algebra & Algebra*,68 章,网站在 `site/`。+把一本书(PDF)做成带动画、语音和互动练习的网页书。网站在 `site/`,首页书架目前收录:++- *Pre-Algebra & Algebra*:68 章,保留原有 `site/chNN/` 路径。+- *Ace Math & the Big Fat Notebook*:已完成前三章,入口在 `site/math-notebook/`;全书规划为 63 章,后续制作因 API 成本暂停。完整制作流程、脚本、引擎与模板都在技能 `.claude/skills/animebook/`(英文,从 `SKILL.md` 读起)。本书的计划与进度见 `plan.md`,目录地图与约定见 `CLAUDE.md`。+第二本书从 Book2 合并,使用独立引擎和学习进度;约定与进度见 `books/math-notebook/BOOK.md` 和 `chapters.md`,讲稿在 `content/math-notebook/`,检查脚本在 `tools/math-notebook/`。原始 PDF 和提取书页仅供本地制作,不进入 Git 或部署目录。+常用命令(`SKILL=.claude/skills/animebook`):```sh@@ -11,4 +16,5 @@ uv run --with pymupdf $SKILL/scripts/outline.py book.pdf # 看 Puv run --with pymupdf $SKILL/scripts/split_pages.py book.pdf # 按章导出书页图片和 text.mdpython3 -m http.server 8765 -d site # 本地预览uv run --with playwright tools/e2e_ch01.py # 某章端到端测试+uv run --with playwright tools/math-notebook/smoke_ch01.py # 第二本书;另有 ch02、ch03```diff --git a/books/math-notebook/BOOK.md b/books/math-notebook/BOOK.mdnew file mode 100644index 0000000..b24ee24--- /dev/null+++ b/books/math-notebook/BOOK.md@@ -0,0 +1,35 @@+# Everything You Need to Ace Math in One Big Fat Notebook — book plan++Read this compact current state for chapter work. The chapter map/status lives in `chapters.md`; storyboards, errata and feedback live in `chapters/chNN.md`.++## Intake+- Readers: middle schoolers (11–14) · Tone: light, upbeat, notebook-style (warm, a little funny, never childish) · Narration language: English · Guide character: default infinity guide · Publish to: local preview only for now.+- Slug: `math-notebook` · Primary language code: `en` · Asset approach: code/SVG only.+- Source: `book.pdf` · Page map: `sections.json` · 530 pages, 63 chapters in 6 units.+- Current scope: paused after ch03 for cost (user, 2026-10-03); ask before making ch04+.+- Units: 1 The Number System (ch1–14) · 2 Ratios, Proportions, and Percents (15–26) · 3 Expressions and Equations (27–39) · 4 Geometry (40–50) · 5 Statistics and Probability (51–54) · 6 The Coordinate Plane and Functions (55–63).+- Source note: the PDF bookmark for ch29 points to page 1; the map uses page 195.++## Conventions (approved in the pilot on 2026-10-03; later chapters follow them)+- Look: engine chalkboard (`COL.board` background, chalk text, `UI` sans, `MATH` serif). Number families keep the engine hues everywhere: natural coral, whole blue, integer yellow, rational pink, irrational green, real violet. `COL.task` (amber) marks "look here"; good/bad for feedback only.+- Narration: `en-US-AndrewMultilingualNeural`, rate −4%. Read math in words ("negative two point three eight", "the square root of two").+- Questions: quick checks act on the picture (sorter into the number map, tap on the number line, grid classification); practice on `SCREEN`.+- Sign colours: engine `POS` (blue) = positive, `NEG` (coral) = negative, chalk = zero (matches signed tiles, ch11–13). Family hues only in number-type chapters.+- Amber `COL.task` also means distance / absolute value (tapes, the | | bars), from ch03.+- Subject conventions: whole numbers start at 0, natural numbers at 1. Repeating decimals use an overbar. Approximations use ≈ and "…".++## Visual models / available helpers+- Number map (nested rings, `RINGS`/`buildVenn`/`sorter`, engine): number-type chapters (1, 34).+- Number line (`numberLine`, `X`, `dot`, `landDot`, `move`, engine): ch1–3, 11–14, 38.+- Repeat bar: `OV('3')` math part in this book's engine (`['0.', OV('3')]` = 0.3̄); added in ch01, for decimal chapters.+- ch01 chapter helpers (copy or promote when reused): `note` (family title + lines beside the map), `ringIn`, `vnum`/`fly` (numbers in or into the map), `sideEq` (equation aligned on =), `mark` (labelled point on the line), `tapDots` (tap with visible candidate dots).+- ch02 number-line helpers: `pnBand` (tint one side), `pnHops` (unit hops from 0), `pnFlip` (flip a dot across 0, recolour), `pnTip`, `pnArrow`, `pnCoin`, `pnDotFx` (answer dot), `pnBlanks` (blanks with a sentence before each box; accepts leading + and thousands commas). Reuse in ch03, 11–14.+- ch03 helpers: `avTape` (distance tape on the number line, lift/slide, tw or fx), `avVTape` (vertical), `BAR` token, `sv(v)` (signed-colour token), `avRow`/`showT`, `avBox` (dashed "do this first"), `avDiver`, `avSub`. Reuse in ch11–14, ch38.+- Signed tiles (`tile`, `cancelPairs`, engine): ch11–13. Fraction rows, decimal point hops, algebra tiles, balance, coordinate plane: engine, for later units.++## Current decisions+- Pilot chapter 1 approved by the user (2026-10-03). Its look, pacing, question mix and side-notes layout are the model for later chapters; `site/math-notebook/ch01/index.html` is the reference implementation.+- Layout used in ch01: number map on the left (engine `RINGS`), notes column at x ≥ 1290; number line −4…4 with `AXIS.u = 160`.+- Local preview: `python3 -m http.server 8765 -d site` (AnimeBook preview; use port 8793 if 8765 is occupied).+- Tests: `tools/math-notebook/smoke_chNN.py` (keyboard runs through quick checks; ch01–ch03).+- Registering: `python3 tools/math-notebook/register.py N minutes` (UNITS, previous CHAPTER.next, chapters.md row).diff --git a/books/math-notebook/WORKER.md b/books/math-notebook/WORKER.mdnew file mode 100644index 0000000..ba31d00--- /dev/null+++ b/books/math-notebook/WORKER.md@@ -0,0 +1,22 @@+# Chapter worker brief (math-notebook)++You make ONE chapter of the animated book, end to end, then report back in a few lines. The coordinator registers it.++## Paths (repo root `/Users/a1212/Projects/AnimeBook`)+- Skill: `SKILL=/Users/a1212/Projects/AnimeBook/.claude/skills/animebook` — read `$SKILL/SKILL.md` (Chapter loop), then only the references you need: `references/authoring.md` (storyboard, narration, questions), `references/engine.md` (API), `references/review.md` (delivery pass).+- Book state: `books/math-notebook/BOOK.md` (conventions + helper index — follow it), `books/math-notebook/chapters.md` (your row).+- Source text: `books/math-notebook/pages/chNN/text.md` (already extracted). Render page images when diagrams/fractions are lost in the text: `uv run --with pymupdf $SKILL/scripts/split_pages.py books/math-notebook/book.pdf --sections books/math-notebook/sections.json --out books/math-notebook/pages --only chNN`. Look only at the pages you need.+- Write: `books/math-notebook/chapters/chNN.md` (storyboard, errata, verified answers — same shape as `chapters/ch01.md`), `content/math-notebook/chNN/narration.en.json`, `site/math-notebook/chNN/index.html`, audio via `uv run --with edge-tts $SKILL/scripts/tts.py content/math-notebook/chNN/narration.en.json site/math-notebook/chNN/audio/en`.+- Reference implementation (approved pilot): `site/math-notebook/ch01/index.html` — same head (incl. `<link rel="expect" …>`), `CHAPTER`, helper style, beat shape, intro card ("Unit U · <unit name> · Chapter N", title on one or two lines), wrap, `final1…` "Chapter practice N of M", `finish`. Copy patterns; don't copy its number-map content unless the topic needs it. If an earlier chapter already has a helper you need (see BOOK.md helper index), copy it from that chapter.+- Preview server: `http://localhost:8765/` serves `site/` (book at `http://localhost:8765/math-notebook/`). If it doesn't answer, start your own: `python3 -m http.server 8793 -d /Users/a1212/Projects/AnimeBook/site` in the background (do not stop any existing preview server).++## Rules+- English narration, voice/rate from BOOK.md; middle-school readers, light and warm, explains why. Usually 6–10 minutes; let the content decide. Teach the chapter's own scope from the source; re-create examples (don't copy the book's drawings); verify every number and answer you use; never judge irrationality from finitely many digits.+- The picture argues: things move, split, line up, compare. Same colour = same meaning (BOOK.md palette). Open each clearing beat with its subject on screen. Questions act on the picture where possible; 2–3 quick checks between lesson beats; 2–4 practice sets.+- Shared engine `site/math-notebook/lib/engine.js`: prefer chapter-local helpers (prefix names to avoid collisions with engine globals). Only add to the engine in a backward-compatible way; if you do, re-run `check_blank.py` for all existing chapters and report it.+- Do NOT edit other chapters, `site/math-notebook/index.html`, `chapters.md` or `BOOK.md` — report what should change instead. Don't commit, push or publish.+- Delivery pass (review.md): `shot.py chNN --url http://localhost:8765/math-notebook/ --out /tmp/animebook-mn-chNN` (beat spec indices are 0-based), read the sheets once, fix clear defects (overlap, clipping, cards covering the asked object, leftovers, wrong geometry, crowded text), recheck those beats; `check_blank.py site/math-notebook chNN --url http://localhost:8765/math-notebook/` (no output = clean). Smoke-test any new question type by keyboard (note: call `hideCover()` before `seek(i,false)` in Playwright).+- Keep your context small: don't read whole engine files; grep for the functions you use.++## Report (≤ 10 lines)+Files written; minutes (sum of audio + question time, rounded); delivery result (errors, blank check, defects fixed / unresolved); errata vs. the book; new helpers (name, file, purpose) and any proposed BOOK.md convention; anything the coordinator must register.diff --git a/books/math-notebook/chapters.md b/books/math-notebook/chapters.mdnew file mode 100644index 0000000..473e496--- /dev/null+++ b/books/math-notebook/chapters.md@@ -0,0 +1,69 @@+# Math Notebook — chapter map++Status: planned → ready (delivered for review) → user-approved. Minutes are estimates until a chapter is made.++| # | Title | Unit | Minutes | Status |+| --- | --- | --- | --- | --- |+| 1 | Types of Numbers and the Number Line | 1 | 9 | user-approved |+| 2 | Positive and Negative Numbers | 1 | 8 | ready |+| 3 | Absolute Value | 1 | 9 | ready |+| 4 | Factors and Greatest Common Factor | 1 | ~7 | planned |+| 5 | Multiples and Least Common Multiple | 1 | ~5 | planned |+| 6 | Fraction Basics: Types of Fractions and Adding and Subtracting Fractions | 1 | ~9 | planned |+| 7 | Multiplying and Dividing Fractions | 1 | ~5 | planned |+| 8 | Adding and Subtracting Decimals | 1 | ~5 | planned |+| 9 | Multiplying Decimals | 1 | ~5 | planned |+| 10 | Dividing Decimals | 1 | ~5 | planned |+| 11 | Adding Positive and Negative Numbers | 1 | ~5 | planned |+| 12 | Subtracting Positive and Negative Numbers | 1 | ~5 | planned |+| 13 | Multiplying and Dividing Positive and Negative Numbers | 1 | ~5 | planned |+| 14 | Inequalities | 1 | ~5 | planned |+| 15 | Ratios | 2 | ~5 | planned |+| 16 | Unit Rate and Unit Price | 2 | ~5 | planned |+| 17 | Proportions | 2 | ~7 | planned |+| 18 | Converting Measurements | 2 | ~7 | planned |+| 19 | Percent | 2 | ~5 | planned |+| 20 | Percent Word Problems | 2 | ~5 | planned |+| 21 | Taxes and Fees | 2 | ~7 | planned |+| 22 | Discounts and Markups | 2 | ~9 | planned |+| 23 | Gratuity and Commission | 2 | ~5 | planned |+| 24 | Simple Interest | 2 | ~7 | planned |+| 25 | Percent Rate of Change | 2 | ~5 | planned |+| 26 | Tables and Ratios | 2 | ~5 | planned |+| 27 | Expressions | 3 | ~6 | planned |+| 28 | Properties | 3 | ~9 | planned |+| 29 | Like Terms | 3 | ~5 | planned |+| 30 | Exponents | 3 | ~7 | planned |+| 31 | Order of Operations | 3 | ~5 | planned |+| 32 | Scientific Notation | 3 | ~5 | planned |+| 33 | Square and Cube Roots | 3 | ~5 | planned |+| 34 | Comparing Irrational Numbers | 3 | ~5 | planned |+| 35 | Equations | 3 | ~5 | planned |+| 36 | Solving for Variables | 3 | ~5 | planned |+| 37 | Solving Multistep Equations | 3 | ~5 | planned |+| 38 | Solving and Graphing Inequalities | 3 | ~5 | planned |+| 39 | Word Problems with Equations and Inequalities | 3 | ~7 | planned |+| 40 | Introduction to Geometry | 4 | ~11 | planned |+| 41 | Angles | 4 | ~9 | planned |+| 42 | Quadrilaterals and Area | 4 | ~9 | planned |+| 43 | Triangles and Area | 4 | ~7 | planned |+| 44 | The Pythagorean Theorem | 4 | ~5 | planned |+| 45 | Circles, Circumference, and Area | 4 | ~7 | planned |+| 46 | Three-Dimensional Figures | 4 | ~8 | planned |+| 47 | Volume | 4 | ~8 | planned |+| 48 | Surface Area | 4 | ~9 | planned |+| 49 | Angles, Triangles, and Transversal Lines | 4 | ~7 | planned |+| 50 | Similar Figures and Scale Drawings | 4 | ~9 | planned |+| 51 | Introduction to Statistics | 5 | ~8 | planned |+| 52 | Measures of Central Tendency and Variation | 5 | ~9 | planned |+| 53 | Displaying Data | 5 | ~11 | planned |+| 54 | Probability | 5 | ~9 | planned |+| 55 | The Coordinate Plane | 6 | ~10 | planned |+| 56 | Relations, Lines, and Functions | 6 | ~11 | planned |+| 57 | Slope | 6 | ~11 | planned |+| 58 | Linear Equations and Functions | 6 | ~9 | planned |+| 59 | Simultaneous Linear Equations and Functions | 6 | ~11 | planned |+| 60 | Nonlinear Functions | 6 | ~11 | planned |+| 61 | Polygons and the Coordinate Plane | 6 | ~6 | planned |+| 62 | Transformations | 6 | ~11 | planned |+| 63 | Proportional Relationships and Graphs | 6 | ~10 | planned |diff --git a/books/math-notebook/chapters/ch01.md b/books/math-notebook/chapters/ch01.mdnew file mode 100644index 0000000..8b10440--- /dev/null+++ b/books/math-notebook/chapters/ch01.md@@ -0,0 +1,34 @@+# Chapter 1 — Types of Numbers and the Number Line++Source pages 13–22. Visual argument: the number map grows outward one ring per family (each new family contains the old one), then the families are placed on a number line.++## Beats+| Beat | Picture | Marks |+| --- | --- | --- |+| intro | title card | sub |+| natural | nat ring draws around 1 2 3 4 5 …; side note "counting numbers" | one, ring, nofrac |+| whole | 0 drops in beside them; whole ring wraps nat | zero, ring, around, still |+| integers | −1 … −4 in the new band; int ring wraps whole | neg, ring, around, note |+| q1 | grid: −4, 0, 9 × Natural/Whole/Integer (multi) | — |+| rational | side equations 0.25 = 1/4, 4.12 = 412/100, −7 = −7/1; ½, 0.25, 4.12 land in the rat band; rat ring wraps int | ratio, half, quarter, d412, ring, seven, around |+| repeat | 1/3 = 0.3333… streams, collapses to 0.3̄; flies into rat band | div, bar, rule, fly |+| irrational | π and √2 digits stream (side); irr ring, separate; π, √2 land | pi, root, ring, sep, proof |+| real | real ring wraps all; −2 pulses, chain int → rat → real glows | ring, ex, int, rat, real, nest |+| q2 | sorter (lesson numbers hidden): 46, 0, −12, 6.675, 2/3, √5 | — |+| line | map fades; number line −4…4; "smaller ← → larger"; dots 2, −3 | line, dir, two, three |+| place | −2.38, −3/4, 1/2, √4 (= 2), 3 1/8 with leaders; √2 ≈ 1.41 (green); line glows violet | f1, a–e, irr, all |+| q3 | tap −1/2 among ±1/2, ±3/2; tap the greater of −3, −1 | — |+| wrap | four takeaways | w1–w4, end |+| final1–3 | classify 4 + 4 numbers (all six families); left/right of 0 for 1/45, −0.001, −3 1/8 | — |+| finish | score card | — |++## Errata / source changes+- Practice item 3 in the book is −4.8937587253765348728743… with answer "irrational". Finitely many digits can't show irrationality, so it is replaced by 0.1010010001… (one more 0 each time), whose pattern never repeats.+- Book's definition "Integers: all whole numbers (including positive and negative whole numbers)" is phrased here as "whole numbers and their negatives".+- The book's ring colours differ; the lesson uses the engine family hues (BOOK.md).++## Verified answers+4.5̄ = 41/9 rational; 5.6̄7̄8̄ rational; −9.7654321 rational (terminates); −9/3 = −3 integer; 6.675 rational; 2/3 rational; √5 ≈ 2.236 irrational; √4 = 2; 1/45 right of 0; −0.001 and −3 1/8 left of 0.++## Feedback+- (none yet)diff --git a/books/math-notebook/chapters/ch02.md b/books/math-notebook/chapters/ch02.mdnew file mode 100644index 0000000..60afe6a--- /dev/null+++ b/books/math-notebook/chapters/ch02.md@@ -0,0 +1,37 @@+# Chapter 2 — Positive and Negative Numbers++Source pages 23–30. Visual argument: zero splits the number line into two tinted sides (negative coral, positive blue); real-world opposite pairs fan out from a zero divider; the line stands up (thermometer, sea level); opposites are a flip across zero, and two flips bring a number home.++Sign colours (engine `POS` / `NEG`): positive blue, negative coral, zero chalk; `COL.task` amber for flip arcs and "look here". The bands stay on `S.line` for the whole chapter.++## Beats+| Beat | Picture | Marks |+| --- | --- | --- |+| intro | title card; tiny coral/0/blue line | sub |+| sides | line −8…8 (`AXIS.u = 80`); 0 dot pulses, "0 is neither…"; blue band right "positive · greater than 0", coral band left "negative · less than 0"; mirror pairs ±2, ±5 | zero, pos, neg, mirror |+| signs | +4 marked; "+4 = 4 · the + sign is optional"; −4 marked, "the − sign is required"; +4 dot pulses; amber arrowheads, ∞ / −∞ at the ends, definition of infinity | plus, same, minus, need, ends, inf, ninf, word |+| q1 | side card (`Q1POS`): grid −6, +3, 0, −1.5 × Positive/Negative/Neither; right answers pop a coloured dot on the line | — |+| world | divider at 0, "− negative | positive +"; five opposite pairs slide out (debt/savings, temperature, sea level, debit/credit, charge); two arrows outward | use, r1–r5, pair |+| owe | "Devin borrows $2 from his friend Stanley."; two $1 coins move to Devin; "owes $2: a debt" → move 0→−2; "is owed $2" → move 0→+2 | story, coins, owes, neg, pos |+| q2 | tap (BAND): Ana owes $3 → −3; Ben puts $5 into his account → 5 | — |+| vertical | line hidden; thermometer −30…30 °C, mercury 20 → −10 (+20°, −10°); sea-level scale −40…40 ft, gull +30, submarine −30; tints above/below 0, arrows "above 0: positive / below 0: negative" | up, warm, drop, cold, sea, gull, sub, rule |+| opposites | dots ±5, five hops each side ("5 steps"), "Opposites: same distance from 0, opposite sides"; flip 5 → −5, 8 → −8; 0 is its own opposite | five, nfive, opp, flip, eight, zero |+| oppopp | −6 with a home ring; flip to 6, flip back to −6; "Opposites of opposites property" | start, first, second, rule, home |+| q3 | tap (BAND): opposite of 3 → −3; opposite of the opposite of −7 → −7 | — |+| wrap | four takeaways | w1–w4, end |+| final1 | write the integer: −250, 900, −6, −12, 340 (sentence blanks; "+900" accepted) | — |+| final2 | opposites: −9, 100, 58, −35, 0 | — |+| final3 | true/false: +7 = 7 (T), 0 positive (F), ±3 same distance (T), below 0 on a thermometer negative (T), opposite of a negative is negative (F) | — |+| finish | score card | — |++## Errata / source changes+- No errors found in the source. Examples are re-created: the book's −16 (opposite of the opposite) becomes −6 so it fits the −8…8 line; the practice quantities use new numbers (250 ft, 900 ft, 6°, $12, $340; 9, −100, 58, −35, 0).+- Added beyond the source (consistent with it): "Stanley is owed $2 → +2" as the opposite of Devin's −2; "0 is its own opposite" (asked in final2).+- Absolute value is ch03: the lesson says "same distance from 0" and counts steps, without naming it.+- The book's "draw a number line from −3 to 3" item is omitted (no drawing question type); its "show the opposite of 2" item is covered by the tap checks.++## Verified answers+q1: −6 negative, +3 positive, 0 neither, −1.5 negative. q2: −3, 5. q3: −3, −7. final1: −250, 900, −6, −12, 340. final2: −9, 100, 58, −35, 0. final3: T F T T F. Thermometer: 20 → −10 (a 30-degree drop); sea level ±30 ft.++## Feedback+- (none yet)diff --git a/books/math-notebook/chapters/ch03.md b/books/math-notebook/chapters/ch03.mdnew file mode 100644index 0000000..2f9f527--- /dev/null+++ b/books/math-notebook/chapters/ch03.md@@ -0,0 +1,40 @@+# Chapter 3 — Absolute Value++Source pages 31–36. Visual argument: absolute value is a length. An amber "distance tape" runs from 0 to the number; opposite numbers' tapes lift off the line and match; a number splits into its sign (which side) and its absolute value (how far). Bars are grouping symbols (moves on the line, then the tape), a sign outside is a flip across 0 (ch02's opposites), a number in front lays tapes end to end.++Colours: sign colours as ch02 (`POS` blue, `NEG` coral, zero chalk). `COL.task` amber = distance: tapes, hop counts and the absolute value bars themselves. Number line −8…8, `AXIS.u = 80` (as ch02).++## Beats+| Beat | Picture | Marks |+| --- | --- | --- |+| intro | title card; tiny line with two equal amber tapes from 0 | sub |+| distance | line −8…8, dot −4; "How far is −4 from 0?"; four hops counted 1–4 with the words; tape "distance: 4"; definition; −4 appears, bars slide in: \|−4\| = 4; "read: the absolute value of −4" | far, hops, h1–h4, steps, def, bars, read |+| itself | dot 7, seven hops, tape "distance: 7", \|7\| = 7 "positive: the number itself"; 0 pulses, \|0\| = 0; "An absolute value is never negative." | seven, same, zero, never |+| q1 | tap (BAND): absolute value 2 among −3, −2, 0, 3 → −2; greater absolute value of −6, 4 → −6 (answer draws the tapes) | — |+| pair | dots ±5; tapes on the line, lift and stack: \|−5\|, \|5\| } = 5; "Opposites have the same absolute value."; −5 splits: "−" sign: which side of 0, "5" absolute value: how far | five, nfive, lift, same, split, sign, size |+| world | line hidden; sea-level scale −40…10 ft, diver at −30, vertical tape "depth: 30 ft", \|−30\| = 30; balance card −$42.75 → "she owes $42.75", \|−42.75\| = 42.75; "with a sign: position, balance / absolute value: depth, distance, amount owed" | diver, depth, bal, owe, how |+| q2 | scale −150…50 ft with a submarine at −120 (side card right): depth → 120 (answer draws the tape); Leo's balance −$18.25 → owes 18.25 | — |+| inside | \|5 − 3\| with a dashed box on 5 − 3; moves 0→5 (+5), 5→2 (−3); = \|2\|; tape 0→2; = 2; "Inside first, then the absolute value." | first, five, back, inside, abs, rule |+| outside | −\|6\| = −(6) = −6 with dot 6 flipped to −6; −\|−7\| = −(7): crossed-out "7" (not 7), flip 7 → −7, = −7; "Inside first, then outside." | six, inside, then, flip, seven, inside2, wrong, flip2, rule |+| q3 | tap (BAND): −\|−3\| → −3; \|6 − 2\| → 4 (tape) | — |+| times | 2\|−4\| = 2 · 4 = 8: tape 0→−4 slides to 0→4, a second tape 4→8, dot 8 | front, inside, times, tapes, eight |+| ways | line hidden; 2 × 4, 2 · 4, (2)(4), 2(4) = 8 with an amber bracket "all the same: 8"; ab = a · b, 3x = 3 · x (x circled); "Variable: a letter that stands for a number we don't know yet" | ways, same, var, ab, three, word |+| wrap | four takeaways | w1–w4, end |+| final1 | evaluate: \|−23\|, \|61\|, \|−3.5\|, \|−3/8\|, \|0\| | — |+| final2 | \|9 − 4\|, \|3 · 4\|, −\|38\|, −\|−12\|, 3\|−5\| | — |+| final3 | sentence blanks: Theo's balance −$64.20 → 64.20 (a leading $ accepted); cave floor −85 ft → 85; −9 °C → 9 | — |+| final4 | true/false: \|−8\| = 8 (T), an absolute value can be negative (F), \|−6\| > \|4\| (T), −\|−2\| = 2 (F), \|−10\| = \|10\| (T) | — |+| finish | score card | — |++## Errata / source changes+- The book says "the absolute value is always positive". Corrected to "never negative" (positive or 0), since |0| = 0; the lesson shows |0| = 0 and final1 asks it.+- Examples re-created: |9| → |7| (fits the −8…8 line); −|−16| → −|−7|; Johanne's −$56.50 → Maya's −$42.75; the 94 ft valley → diver at −30 ft. Kept from the book: |−4| = 4, |5 − 3| = |2| = 2, −|6| = −6, 2|−4| = 2 · 4 = 8, the four ways to write multiplication, ab, 3x and the definition of a variable (the book's "3x = 15" and "ab = 8" become "3x = 3 · x" and "ab = a · b", since solving is not taught yet).+- Practice uses new numbers (book: 19, 49, 4.5, 1/5, 4, 5, −65, −9, 56.50, 94).+- Added (consistent with the source): opposites have the same absolute value; sign = which side, absolute value = how far; the common mistake −|−7| ≠ 7.+- Inside-the-bars work is kept to results ≥ 0 (5 − 3, 6 − 2, 9 − 4, 3 · 4): subtracting into negatives is ch12.++## Verified answers+q1: −2; −6 (|−6| = 6 > 4). q2: 120; 18.25. q3: −3; 4. final1: 23, 61, 3.5, 3/8, 0. final2: 5, 12, −38, −12, 15. final3: 64.20, 85, 9. final4: T F T F T. Lesson: |−4| = 4, |7| = 7, |0| = 0, |±5| = 5, |−30| = 30, |−42.75| = 42.75, |5 − 3| = 2, −|6| = −6, −|−7| = −7, 2|−4| = 8.++## Feedback+- (none yet)diff --git a/books/math-notebook/sections.json b/books/math-notebook/sections.jsonnew file mode 100644index 0000000..4054365--- /dev/null+++ b/books/math-notebook/sections.json@@ -0,0 +1,512 @@+[+ {+ "folder": "00_front",+ "title": "Front matter",+ "start": 1,+ "end": 12+ },+ {+ "folder": "ch01",+ "title": "Chapter 1: Types of Numbers and the Number Line",+ "start": 13,+ "end": 22,+ "chapter_start": 14,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch02",+ "title": "Chapter 2: Positive and Negative Numbers",+ "start": 23,+ "end": 30,+ "chapter_start": 23,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch03",+ "title": "Chapter 3: Absolute Value",+ "start": 31,+ "end": 36,+ "chapter_start": 31,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch04",+ "title": "Chapter 4: Factors and Greatest Common Factor",+ "start": 37,+ "end": 44,+ "chapter_start": 37,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch05",+ "title": "Chapter 5: Multiples and Least Common Multiple",+ "start": 45,+ "end": 50,+ "chapter_start": 45,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch06",+ "title": "Chapter 6: Fraction Basics: Types of Fractions and Adding and Subtracting Fractions",+ "start": 51,+ "end": 60,+ "chapter_start": 51,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch07",+ "title": "Chapter 7: Multiplying and Dividing Fractions",+ "start": 61,+ "end": 64,+ "chapter_start": 61,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch08",+ "title": "Chapter 8: Adding and Subtracting Decimals",+ "start": 65,+ "end": 68,+ "chapter_start": 65,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch09",+ "title": "Chapter 9: Multiplying Decimals",+ "start": 69,+ "end": 72,+ "chapter_start": 69,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch10",+ "title": "Chapter 10: Dividing Decimals",+ "start": 73,+ "end": 76,+ "chapter_start": 73,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch11",+ "title": "Chapter 11: Adding Positive and Negative Numbers",+ "start": 77,+ "end": 82,+ "chapter_start": 77,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch12",+ "title": "Chapter 12: Subtracting Positive and Negative Numbers",+ "start": 83,+ "end": 86,+ "chapter_start": 83,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch13",+ "title": "Chapter 13: Multiplying and Dividing Positive and Negative Numbers",+ "start": 87,+ "end": 90,+ "chapter_start": 87,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch14",+ "title": "Chapter 14: Inequalities",+ "start": 91,+ "end": 96,+ "chapter_start": 91,+ "unit": "UNIT 1: The Number System"+ },+ {+ "folder": "ch15",+ "title": "Chapter 15: Ratios",+ "start": 97,+ "end": 102,+ "chapter_start": 98,+ "unit": "UNIT 2: Ratios, Proportions, and Percents"+ },+ {+ "folder": "ch16",+ "title": "Chapter 16: Unit Rate and Unit Price",+ "start": 103,+ "end": 106,+ "chapter_start": 103,+ "unit": "UNIT 2: Ratios, Proportions, and Percents"+ },+ {+ "folder": "ch17",+ "title": "Chapter 17: Proportions",+ "start": 107,+ "end": 114,+ "chapter_start": 107,+ "unit": "UNIT 2: Ratios, Proportions, and Percents"+ },+ {+ "folder": "ch18",+ "title": "Chapter 18: Converting Measurements",+ "start": 115,+ "end": 122,+ "chapter_start": 115,+ "unit": "UNIT 2: Ratios, Proportions, and Percents"+ },+ {+ "folder": "ch19",+ "title": "Chapter 19: Percent",+ "start": 123,+ "end": 128,+ "chapter_start": 123,+ "unit": "UNIT 2: Ratios, Proportions, and Percents"+ },+ {+ "folder": "ch20",+ "title": "Chapter 20: Percent Word Problems",+ "start": 129,+ "end": 134,+ "chapter_start": 129,+ "unit": "UNIT 2: Ratios, Proportions, and Percents"+ },+ {+ "folder": "ch21",+ "title": "Chapter 21: Taxes and Fees",+ "start": 135,+ "end": 142,+ "chapter_start": 135,+ "unit": "UNIT 2: Ratios, Proportions, and Percents"+ },+ {+ "folder": "ch22",+ "title": "Chapter 22: Discounts and Markups",+ "start": 143,+ "end": 152,+ "chapter_start": 143,+ "unit": "UNIT 2: Ratios, Proportions, and Percents"+ },+ {+ "folder": "ch23",+ "title": "Chapter 23: Gratuity and Commission",+ "start": 153,+ "end": 158,+ "chapter_start": 153,+ "unit": "UNIT 2: Ratios, Proportions, and Percents"+ },+ {+ "folder": "ch24",+ "title": "Chapter 24: Simple Interest",+ "start": 159,+ "end": 166,+ "chapter_start": 159,+ "unit": "UNIT 2: Ratios, Proportions, and Percents"+ },+ {+ "folder": "ch25",+ "title": "Chapter 25: Percent Rate of Change",+ "start": 167,+ "end": 170,+ "chapter_start": 167,+ "unit": "UNIT 2: Ratios, Proportions, and Percents"+ },+ {+ "folder": "ch26",+ "title": "Chapter 26: Tables and Ratios",+ "start": 171,+ "end": 176,+ "chapter_start": 171,+ "unit": "UNIT 2: Ratios, Proportions, and Percents"+ },+ {+ "folder": "ch27",+ "title": "Chapter 27: Expressions",+ "start": 177,+ "end": 184,+ "chapter_start": 178,+ "unit": "UNIT 3: Expressions and Equations"+ },+ {+ "folder": "ch28",+ "title": "Chapter 28: Properties",+ "start": 185,+ "end": 194,+ "chapter_start": 185,+ "unit": "UNIT 3: Expressions and Equations"+ },+ {+ "folder": "ch29",+ "title": "Chapter 29: Like Terms",+ "start": 195,+ "end": 200,+ "chapter_start": 195,+ "unit": "UNIT 3: Expressions and Equations"+ },+ {+ "folder": "ch30",+ "title": "Chapter 30: Exponents",+ "start": 201,+ "end": 208,+ "chapter_start": 201,+ "unit": "UNIT 3: Expressions and Equations"+ },+ {+ "folder": "ch31",+ "title": "Chapter 31: Order of Operations",+ "start": 209,+ "end": 214,+ "chapter_start": 209,+ "unit": "UNIT 3: Expressions and Equations"+ },+ {+ "folder": "ch32",+ "title": "Chapter 32: Scientific Notation",+ "start": 215,+ "end": 220,+ "chapter_start": 215,+ "unit": "UNIT 3: Expressions and Equations"+ },+ {+ "folder": "ch33",+ "title": "Chapter 33: Square and Cube Roots",+ "start": 221,+ "end": 226,+ "chapter_start": 221,+ "unit": "UNIT 3: Expressions and Equations"+ },+ {+ "folder": "ch34",+ "title": "Chapter 34: Comparing Irrational Numbers",+ "start": 227,+ "end": 230,+ "chapter_start": 227,+ "unit": "UNIT 3: Expressions and Equations"+ },+ {+ "folder": "ch35",+ "title": "Chapter 35: Equations",+ "start": 231,+ "end": 236,+ "chapter_start": 231,+ "unit": "UNIT 3: Expressions and Equations"+ },+ {+ "folder": "ch36",+ "title": "Chapter 36: Solving for Variables",+ "start": 237,+ "end": 242,+ "chapter_start": 237,+ "unit": "UNIT 3: Expressions and Equations"+ },+ {+ "folder": "ch37",+ "title": "Chapter 37: Solving Multistep Equations",+ "start": 243,+ "end": 248,+ "chapter_start": 243,+ "unit": "UNIT 3: Expressions and Equations"+ },+ {+ "folder": "ch38",+ "title": "Chapter 38: Solving and Graphic Inequalities",+ "start": 249,+ "end": 254,+ "chapter_start": 249,+ "unit": "UNIT 3: Expressions and Equations"+ },+ {+ "folder": "ch39",+ "title": "Chapter 39: Word Problems with Equations and Inequalities",+ "start": 255,+ "end": 262,+ "chapter_start": 255,+ "unit": "UNIT 3: Expressions and Equations"+ },+ {+ "folder": "ch40",+ "title": "Chapter 40: Introduction to Geometry",+ "start": 263,+ "end": 278,+ "chapter_start": 264,+ "unit": "UNIT 4: Geometry"+ },+ {+ "folder": "ch41",+ "title": "Chapter 41: Angles",+ "start": 279,+ "end": 288,+ "chapter_start": 279,+ "unit": "UNIT 4: Geometry"+ },+ {+ "folder": "ch42",+ "title": "Chapter 42: Quadrilaterals and Area",+ "start": 289,+ "end": 298,+ "chapter_start": 289,+ "unit": "UNIT 4: Geometry"+ },+ {+ "folder": "ch43",+ "title": "Chapter 43: Triangles and Area",+ "start": 299,+ "end": 306,+ "chapter_start": 299,+ "unit": "UNIT 4: Geometry"+ },+ {+ "folder": "ch44",+ "title": "Chapter 44: The Pythagorean Theorem",+ "start": 307,+ "end": 312,+ "chapter_start": 307,+ "unit": "UNIT 4: Geometry"+ },+ {+ "folder": "ch45",+ "title": "Chapter 45: Circles, Circumference, and Area",+ "start": 313,+ "end": 320,+ "chapter_start": 313,+ "unit": "UNIT 4: Geometry"+ },+ {+ "folder": "ch46",+ "title": "Chapter 46: Three-Dimensional Figures",+ "start": 321,+ "end": 329,+ "chapter_start": 321,+ "unit": "UNIT 4: Geometry"+ },+ {+ "folder": "ch47",+ "title": "Chapter 47: Volume",+ "start": 330,+ "end": 338,+ "chapter_start": 330,+ "unit": "UNIT 4: Geometry"+ },+ {+ "folder": "ch48",+ "title": "Chapter 48: Surface Area",+ "start": 339,+ "end": 348,+ "chapter_start": 339,+ "unit": "UNIT 4: Geometry"+ },+ {+ "folder": "ch49",+ "title": "Chapter 49: Angles, Triangles, and Transversal Lines",+ "start": 349,+ "end": 356,+ "chapter_start": 349,+ "unit": "UNIT 4: Geometry"+ },+ {+ "folder": "ch50",+ "title": "Chapter 50: Similar Figures and Scale Drawings",+ "start": 357,+ "end": 366,+ "chapter_start": 357,+ "unit": "UNIT 4: Geometry"+ },+ {+ "folder": "ch51",+ "title": "Chapter 51: Introduction to Statistics",+ "start": 367,+ "end": 376,+ "chapter_start": 368,+ "unit": "UNIT 5: Statistics and Probability"+ },+ {+ "folder": "ch52",+ "title": "Chapter 52: Measures of Central Tendency and Variation",+ "start": 377,+ "end": 386,+ "chapter_start": 377,+ "unit": "UNIT 5: Statistics and Probability"+ },+ {+ "folder": "ch53",+ "title": "Chapter 53: Displaying Data",+ "start": 387,+ "end": 406,+ "chapter_start": 387,+ "unit": "UNIT 5: Statistics and Probability"+ },+ {+ "folder": "ch54",+ "title": "Chapter 54: Probability",+ "start": 407,+ "end": 416,+ "chapter_start": 407,+ "unit": "UNIT 5: Statistics and Probability"+ },+ {+ "folder": "ch55",+ "title": "Chapter 55: The Coordinate Plane",+ "start": 417,+ "end": 428,+ "chapter_start": 418,+ "unit": "UNIT 6: The Coordinate Plane and Functions"+ },+ {+ "folder": "ch56",+ "title": "Chapter 56: Relations, Lines, and Functions",+ "start": 429,+ "end": 442,+ "chapter_start": 429,+ "unit": "UNIT 6: The Coordinate Plane and Functions"+ },+ {+ "folder": "ch57",+ "title": "Chapter 57: Slope",+ "start": 443,+ "end": 457,+ "chapter_start": 443,+ "unit": "UNIT 6: The Coordinate Plane and Functions"+ },+ {+ "folder": "ch58",+ "title": "Chapter 58: Linear Equations and Functions",+ "start": 458,+ "end": 467,+ "chapter_start": 458,+ "unit": "UNIT 6: The Coordinate Plane and Functions"+ },+ {+ "folder": "ch59",+ "title": "Chapter 59: Simultaneous Linear Equations and Functions",+ "start": 468,+ "end": 479,+ "chapter_start": 468,+ "unit": "UNIT 6: The Coordinate Plane and Functions"+ },+ {+ "folder": "ch60",+ "title": "Chapter 60: Nonlinear Functions",+ "start": 480,+ "end": 491,+ "chapter_start": 480,+ "unit": "UNIT 6: The Coordinate Plane and Functions"+ },+ {+ "folder": "ch61",+ "title": "Chapter 61: Polygons and the Coordinate Plane",+ "start": 492,+ "end": 498,+ "chapter_start": 492,+ "unit": "UNIT 6: The Coordinate Plane and Functions"+ },+ {+ "folder": "ch62",+ "title": "Chapter 62: Transformations",+ "start": 499,+ "end": 519,+ "chapter_start": 499,+ "unit": "UNIT 6: The Coordinate Plane and Functions"+ },+ {+ "folder": "ch63",+ "title": "Chapter 63: Proportional Relationships and Graphs",+ "start": 520,+ "end": 530,+ "chapter_start": 520,+ "unit": "UNIT 6: The Coordinate Plane and Functions"+ }+]diff --git a/content/math-notebook/ch01/narration.en.json b/content/math-notebook/ch01/narration.en.jsonnew file mode 100644index 0000000..8332174--- /dev/null+++ b/content/math-notebook/ch01/narration.en.json@@ -0,0 +1,24 @@+{+ "voice": "en-US-AndrewMultilingualNeural",+ "rate": "-4%",+ "beats": {+ "intro": "Chapter one. Types of numbers, and the number line. [[sub]]Every number belongs to a family, and some numbers belong to several families at once.",+ "natural": "Let's start with the numbers you learned first: the ones you count with. [[one]]One, two, three, four, five, and on and on. [[ring]]These are the natural numbers. Some teachers call them the counting numbers. [[nofrac]]No zero, no fractions, no negatives. Just counting.",+ "whole": "Now add one more number: [[zero]]zero. [[ring]]The natural numbers plus zero make the whole numbers. [[around]]Notice the new ring goes around the old one. Every natural number is also a whole number. [[still]]Whole numbers still have no fractions, no decimals, and nothing negative.",+ "integers": "What about numbers below zero? [[neg]]Negative one, negative two, negative three, and so on. [[ring]]Put the whole numbers together with their negatives, and you get the integers. [[around]]Again, the new ring wraps around the old ones. Every whole number is an integer too. [[note]]Integers are still whole steps: no fractions, no decimals.",+ "q1": "Quick check. Pick every family each number belongs to.",+ "rational": "Next up: fractions. [[ratio]]A rational number is any number you can write as one integer divided by another. Think of its root word: ratio. [[half]]One half is rational. So is [[quarter]]zero point two five, because it equals one fourth. [[d412]]Four point one two is four hundred twelve hundredths. [[seven]]Here's the surprise: negative seven is rational too, because it's negative seven over one. Every integer can be written that way. [[ring]]So the rational ring goes around all the integers.",+ "repeat": "What about one third? [[div]]Divide one by three and you get zero point three three three, and the threes never stop. [[bar]]We write that with a little bar over the three. The bar means: this part repeats forever. [[rule]]So a decimal that ends, or a decimal that repeats, is rational. [[fly]]One third goes in the rational ring.",+ "irrational": "But some numbers can't be written as a fraction at all. [[pi]]Pi is three point one four one five nine two six five, and it keeps going, with no block of digits that repeats. [[root]]The square root of two is one point four one four two one three, and it never repeats either. [[ring]]These are irrational numbers. Their decimals never end and never repeat. [[sep]]They get their own ring, outside the rational numbers. A number is rational or irrational, never both. [[proof]]By the way, a few digits can't prove a number is irrational. Mathematicians proved it for pi and the square root of two.",+ "real": "Finally, [[ring]]put the rational and irrational numbers together. These are the real numbers: every number you can find on a number line. [[ex]]Take negative two. [[int]]It's an integer, [[rat]]so it's also rational, [[real]]and it's real. [[nest]]A number belongs to its own ring and to every ring around it.",+ "q2": "Quick check. Put each number in its smallest ring.",+ "line": "Now let's line the numbers up. [[line]]A number line puts numbers in order. [[dir]]Smaller numbers are on the left. Larger numbers are on the right. [[two]]Two is larger than one and larger than zero, so it sits to their right. [[three]]Negative three is smaller than negative two and negative one, so it sits to their left.",+ "place": "Every rational number has a spot, [[f1]]not just the integers. [[a]]Negative two point three eight sits a little past negative two. [[b]]Negative three fourths is between negative one and zero. [[c]]One half is halfway from zero to one. [[d]]And the square root of four? It looks irrational, but it's exactly two. [[e]]Three and one eighth is just past three. [[irr]]Irrational numbers have spots too. The square root of two is about one point four one. [[all]]Together, the real numbers fill the whole line.",+ "q3": "Quick check. Find the points on the number line.",+ "wrap": "To sum up. [[w1]]Each family adds new numbers: zero for the whole numbers, negatives for the integers, fractions for the rationals. [[w2]]Rational numbers can be written as a fraction. Their decimals end or repeat. [[w3]]Irrational decimals never end and never repeat. Rational and irrational together make the real numbers. [[w4]]On a number line, smaller is left and larger is right. [[end]]Now try the chapter practice.",+ "final1": "Chapter practice. Classify each number in every family it belongs to.",+ "final2": "Four more numbers to classify.",+ "final3": "Last one. Left or right of zero?",+ "finish": "Nice work. That's the end of chapter one."+ }+}diff --git a/content/math-notebook/ch01/narration.en.timings.json b/content/math-notebook/ch01/narration.en.timings.jsonnew file mode 100644index 0000000..b0cf50a--- /dev/null+++ b/content/math-notebook/ch01/narration.en.timings.json@@ -0,0 +1,3401 @@+{+ "intro": {+ "key": "a9efdea2fbee5b66806a3ad7c03abb13e7e9dfce",+ "dur": 9.192,+ "words": [+ [+ 0.104166,+ "Chapter"+ ],+ [+ 0.429708,+ "one"+ ],+ [+ 1.106791,+ "Types"+ ],+ [+ 1.354166,+ "of"+ ],+ [+ 1.458333,+ "numbers"+ ],+ [+ 2.369791,+ "and"+ ],+ [+ 2.473958,+ "the"+ ],+ [+ 2.539083,+ "number"+ ],+ [+ 2.8125,+ "line"+ ],+ [+ 3.606791,+ "Every"+ ],+ [+ 3.841166,+ "number"+ ],+ [+ 4.192708,+ "belongs"+ ],+ [+ 4.739583,+ "to"+ ],+ [+ 4.882833,+ "a"+ ],+ [+ 4.934916,+ "family"+ ],+ [+ 5.9375,+ "and"+ ],+ [+ 6.08075,+ "some"+ ],+ [+ 6.289083,+ "numbers"+ ],+ [+ 6.692708,+ "belong"+ ],+ [+ 7.1745,+ "to"+ ],+ [+ 7.265625,+ "several"+ ],+ [+ 7.747416,+ "families"+ ],+ [+ 8.203125,+ "at"+ ],+ [+ 8.28125,+ "once"+ ]+ ],+ "marks": {+ "sub": 3.607+ },+ "cues": [+ [+ 0.104,+ "Chapter one."+ ],+ [+ 1.107,+ "Types of numbers, and the number line."+ ],+ [+ 3.607,+ "Every number belongs to a family, and some numbers belong to several families at once."+ ]+ ]+ },+ "natural": {+ "key": "be2ade7f7fde5d57cc2cb0485c48f9719316d7fa",+ "dur": 17.4,+ "words": [+ [+ 0.104166,+ "Let's"+ ],+ [+ 0.247416,+ "start"+ ],+ [+ 0.46875,+ "with"+ ],+ [+ 0.572916,+ "the"+ ],+ [+ 0.638041,+ "numbers"+ ],+ [+ 0.963541,+ "you"+ ],+ [+ 1.08075,+ "learned"+ ],+ [+ 1.315125,+ "first"+ ],+ [+ 2.5,+ "the"+ ],+ [+ 2.578125,+ "ones"+ ],+ [+ 2.851583,+ "you"+ ],+ [+ 2.95575,+ "count"+ ],+ [+ 3.26825,+ "with"+ ],+ [+ 4.0495,+ "One"+ ],+ [+ 4.51825,+ "two"+ ],+ [+ 5.039083,+ "three"+ ],+ [+ 5.833333,+ "four"+ ],+ [+ 6.223958,+ "five"+ ],+ [+ 7.01825,+ "and"+ ],+ [+ 7.161458,+ "on"+ ],+ [+ 7.356791,+ "and"+ ],+ [+ 7.434916,+ "on"+ ],+ [+ 8.151041,+ "These"+ ],+ [+ 8.294291,+ "are"+ ],+ [+ 8.346375,+ "the"+ ],+ [+ 8.411458,+ "natural"+ ],+ [+ 8.854166,+ "numbers"+ ],+ [+ 9.83075,+ "Some"+ ],+ [+ 10.026041,+ "teachers"+ ],+ [+ 10.507833,+ "call"+ ],+ [+ 10.807291,+ "them"+ ],+ [+ 11.237,+ "the"+ ],+ [+ 11.328125,+ "counting"+ ],+ [+ 11.71875,+ "numbers"+ ],+ [+ 12.682291,+ "No"+ ],+ [+ 12.825541,+ "zero"+ ],+ [+ 13.737,+ "no"+ ],+ [+ 13.841166,+ "fractions"+ ],+ [+ 15.013041,+ "no"+ ],+ [+ 15.104166,+ "negatives"+ ],+ [+ 16.354166,+ "Just"+ ],+ [+ 16.510416,+ "counting"+ ]+ ],+ "marks": {+ "one": 4.05,+ "ring": 8.151,+ "nofrac": 12.682+ },+ "cues": [+ [+ 0.104,+ "Let's start with the numbers you learned first: the ones you count with."+ ],+ [+ 4.05,+ "One, two, three, four, five, and on and on."+ ],+ [+ 8.151,+ "These are the natural numbers."+ ],+ [+ 9.831,+ "Some teachers call them the counting numbers."+ ],+ [+ 12.682,+ "No zero, no fractions, no negatives."+ ],+ [+ 16.354,+ "Just counting."+ ]+ ]+ },+ "whole": {+ "key": "c96d39ec4e15497d865ccc95983c4f9996c196bb",+ "dur": 17.736,+ "words": [+ [+ 0.104166,+ "Now"+ ],+ [+ 0.286458,+ "add"+ ],+ [+ 0.377625,+ "one"+ ],+ [+ 0.585958,+ "more"+ ],+ [+ 0.794291,+ "number"+ ],+ [+ 1.666666,+ "zero"+ ],+ [+ 2.591166,+ "The"+ ],+ [+ 2.65625,+ "natural"+ ],+ [+ 3.033875,+ "numbers"+ ],+ [+ 3.4375,+ "plus"+ ],+ [+ 3.89325,+ "zero"+ ],+ [+ 4.739583,+ "make"+ ],+ [+ 5.078125,+ "the"+ ],+ [+ 5.169291,+ "whole"+ ],+ [+ 5.494791,+ "numbers"+ ],+ [+ 6.510416,+ "Notice"+ ],+ [+ 6.757833,+ "the"+ ],+ [+ 6.848958,+ "new"+ ],+ [+ 7.213541,+ "ring"+ ],+ [+ 7.760416,+ "goes"+ ],+ [+ 8.177083,+ "around"+ ],+ [+ 8.476583,+ "the"+ ],+ [+ 8.554708,+ "old"+ ],+ [+ 8.789083,+ "one"+ ],+ [+ 9.479166,+ "Every"+ ],+ [+ 9.661458,+ "natural"+ ],+ [+ 10.039083,+ "number"+ ],+ [+ 10.76825,+ "is"+ ],+ [+ 10.9245,+ "also"+ ],+ [+ 11.328125,+ "a"+ ],+ [+ 11.380208,+ "whole"+ ],+ [+ 11.71875,+ "number"+ ],+ [+ 12.617208,+ "Whole"+ ],+ [+ 12.8125,+ "numbers"+ ],+ [+ 13.177083,+ "still"+ ],+ [+ 13.385416,+ "have"+ ],+ [+ 13.567708,+ "no"+ ],+ [+ 13.867208,+ "fractions"+ ],+ [+ 15.039083,+ "no"+ ],+ [+ 15.2995,+ "decimals"+ ],+ [+ 16.276041,+ "and"+ ],+ [+ 16.471375,+ "nothing"+ ],+ [+ 16.796875,+ "negative"+ ]+ ],+ "marks": {+ "zero": 1.667,+ "ring": 2.591,+ "around": 6.51,+ "still": 12.617+ },+ "cues": [+ [+ 0.104,+ "Now add one more number: zero."+ ],+ [+ 2.591,+ "The natural numbers plus zero make the whole numbers."+ ],+ [+ 6.51,+ "Notice the new ring goes around the old one."+ ],+ [+ 9.479,+ "Every natural number is also a whole number."+ ],+ [+ 12.617,+ "Whole numbers still have no fractions, no decimals, and nothing negative."+ ]+ ]+ },+ "integers": {+ "key": "2b25777bf150aa290b932d842e05c3b7b1af9186",+ "dur": 21.936,+ "words": [+ [+ 0.104166,+ "What"+ ],+ [+ 0.195333,+ "about"+ ],+ [+ 0.45575,+ "numbers"+ ],+ [+ 0.833333,+ "below"+ ],+ [+ 1.210958,+ "zero"+ ],+ [+ 2.213541,+ "Negative"+ ],+ [+ 2.552083,+ "one"+ ],+ [+ 3.125,+ "negative"+ ],+ [+ 3.59375,+ "two"+ ],+ [+ 4.505208,+ "negative"+ ],+ [+ 4.908875,+ "three"+ ],+ [+ 5.677083,+ "and"+ ],+ [+ 5.807291,+ "so"+ ],+ [+ 6.119791,+ "on"+ ],+ [+ 6.822916,+ "Put"+ ],+ [+ 6.992208,+ "the"+ ],+ [+ 7.096375,+ "whole"+ ],+ [+ 7.487,+ "numbers"+ ],+ [+ 7.890625,+ "together"+ ],+ [+ 8.359375,+ "with"+ ],+ [+ 8.489583,+ "their"+ ],+ [+ 8.59375,+ "negatives"+ ],+ [+ 9.583333,+ "and"+ ],+ [+ 9.713541,+ "you"+ ],+ [+ 9.84375,+ "get"+ ],+ [+ 10.039083,+ "the"+ ],+ [+ 10.15625,+ "integers"+ ],+ [+ 11.237,+ "Again"+ ],+ [+ 12.096375,+ "the"+ ],+ [+ 12.1745,+ "new"+ ],+ [+ 12.434916,+ "ring"+ ],+ [+ 12.721375,+ "wraps"+ ],+ [+ 13.059916,+ "around"+ ],+ [+ 13.333333,+ "the"+ ],+ [+ 13.398458,+ "old"+ ],+ [+ 13.645833,+ "ones"+ ],+ [+ 14.557291,+ "Every"+ ],+ [+ 14.791666,+ "whole"+ ],+ [+ 15.0,+ "number"+ ],+ [+ 15.612,+ "is"+ ],+ [+ 15.703125,+ "an"+ ],+ [+ 15.807291,+ "integer"+ ],+ [+ 16.197916,+ "too"+ ],+ [+ 17.01825,+ "Integers"+ ],+ [+ 17.395833,+ "are"+ ],+ [+ 17.5,+ "still"+ ],+ [+ 17.825541,+ "whole"+ ],+ [+ 18.059916,+ "steps"+ ],+ [+ 19.088541,+ "no"+ ],+ [+ 19.414083,+ "fractions"+ ],+ [+ 20.481791,+ "no"+ ],+ [+ 20.78125,+ "decimals"+ ]+ ],+ "marks": {+ "neg": 2.214,+ "ring": 6.823,+ "around": 11.237,+ "note": 17.018+ },+ "cues": [+ [+ 0.104,+ "What about numbers below zero?"+ ],+ [+ 2.214,+ "Negative one, negative two, negative three, and so on."+ ],+ [+ 6.823,+ "Put the whole numbers together with their negatives, and you get the integers."+ ],+ [+ 11.237,+ "Again, the new ring wraps around the old ones."+ ],+ [+ 14.557,+ "Every whole number is an integer too."+ ],+ [+ 17.018,+ "Integers are still whole steps: no fractions, no decimals."+ ]+ ]+ },+ "q1": {+ "key": "61070eb6386b6ebb8a77bd1513521af54c8a1d89",+ "dur": 4.248,+ "words": [+ [+ 0.104166,+ "Quick"+ ],+ [+ 0.286458,+ "check"+ ],+ [+ 1.184916,+ "Pick"+ ],+ [+ 1.536458,+ "every"+ ],+ [+ 1.796875,+ "family"+ ],+ [+ 2.526041,+ "each"+ ],+ [+ 2.773458,+ "number"+ ],+ [+ 3.033875,+ "belongs"+ ],+ [+ 3.554708,+ "to"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.185,+ "Pick every family each number belongs to."+ ]+ ]+ },+ "rational": {+ "key": "9bef4dc20cc2699a015db4902263c03471fb2d6f",+ "dur": 32.592,+ "words": [+ [+ 0.104166,+ "Next"+ ],+ [+ 0.338541,+ "up"+ ],+ [+ 0.807291,+ "fractions"+ ],+ [+ 2.03125,+ "A"+ ],+ [+ 2.083333,+ "rational"+ ],+ [+ 2.539083,+ "number"+ ],+ [+ 3.372416,+ "is"+ ],+ [+ 3.645833,+ "any"+ ],+ [+ 3.854166,+ "number"+ ],+ [+ 4.140625,+ "you"+ ],+ [+ 4.270833,+ "can"+ ],+ [+ 4.440125,+ "write"+ ],+ [+ 5.15625,+ "as"+ ],+ [+ 5.3125,+ "one"+ ],+ [+ 5.651041,+ "integer"+ ],+ [+ 6.119791,+ "divided"+ ],+ [+ 6.5625,+ "by"+ ],+ [+ 6.71875,+ "another"+ ],+ [+ 7.630208,+ "Think"+ ],+ [+ 7.747416,+ "of"+ ],+ [+ 7.8125,+ "its"+ ],+ [+ 7.929708,+ "root"+ ],+ [+ 8.216166,+ "word"+ ],+ [+ 9.0625,+ "ratio"+ ],+ [+ 10.169291,+ "One"+ ],+ [+ 10.3125,+ "half"+ ],+ [+ 10.885416,+ "is"+ ],+ [+ 11.002625,+ "rational"+ ],+ [+ 12.03125,+ "So"+ ],+ [+ 12.278666,+ "is"+ ],+ [+ 12.460958,+ "zero"+ ],+ [+ 12.7995,+ "point"+ ],+ [+ 13.033875,+ "two"+ ],+ [+ 13.203125,+ "five"+ ],+ [+ 13.932291,+ "because"+ ],+ [+ 14.270833,+ "it"+ ],+ [+ 14.466166,+ "equals"+ ],+ [+ 14.856791,+ "one"+ ],+ [+ 15.208333,+ "fourth"+ ],+ [+ 16.237,+ "Four"+ ],+ [+ 16.328125,+ "point"+ ],+ [+ 16.5625,+ "one"+ ],+ [+ 16.744791,+ "two"+ ],+ [+ 17.317708,+ "is"+ ],+ [+ 17.604166,+ "four"+ ],+ [+ 17.994791,+ "hundred"+ ],+ [+ 18.333333,+ "twelve"+ ],+ [+ 18.606791,+ "hundredths"+ ],+ [+ 19.6745,+ "Here's"+ ],+ [+ 19.895833,+ "the"+ ],+ [+ 20.0,+ "surprise"+ ],+ [+ 21.210958,+ "negative"+ ],+ [+ 21.653666,+ "seven"+ ],+ [+ 22.161458,+ "is"+ ],+ [+ 22.317708,+ "rational"+ ],+ [+ 22.942708,+ "too"+ ],+ [+ 23.710958,+ "because"+ ],+ [+ 24.0495,+ "it's"+ ],+ [+ 24.166666,+ "negative"+ ],+ [+ 24.752625,+ "seven"+ ],+ [+ 25.221375,+ "over"+ ],+ [+ 25.442708,+ "one"+ ],+ [+ 26.171875,+ "Every"+ ],+ [+ 26.484375,+ "integer"+ ],+ [+ 27.278666,+ "can"+ ],+ [+ 27.395833,+ "be"+ ],+ [+ 27.578125,+ "written"+ ],+ [+ 27.8125,+ "that"+ ],+ [+ 28.020833,+ "way"+ ],+ [+ 28.737,+ "So"+ ],+ [+ 28.880208,+ "the"+ ],+ [+ 28.958333,+ "rational"+ ],+ [+ 29.570333,+ "ring"+ ],+ [+ 29.908875,+ "goes"+ ],+ [+ 30.208333,+ "around"+ ],+ [+ 31.106791,+ "all"+ ],+ [+ 31.328125,+ "the"+ ],+ [+ 31.445333,+ "integers"+ ]+ ],+ "marks": {+ "ratio": 2.031,+ "half": 10.169,+ "quarter": 12.461,+ "d412": 16.237,+ "seven": 19.674,+ "ring": 28.737+ },+ "cues": [+ [+ 0.104,+ "Next up: fractions."+ ],+ [+ 2.031,+ "A rational number is any number you can write as one integer divided by another."+ ],+ [+ 7.63,+ "Think of its root word: ratio."+ ],+ [+ 10.169,+ "One half is rational."+ ],+ [+ 12.031,+ "So is zero point two five, because it equals one fourth."+ ],+ [+ 16.237,+ "Four point one two is four hundred twelve hundredths."+ ],+ [+ 19.674,+ "Here's the surprise: negative seven is rational too, because it's negative seven over one."+ ],+ [+ 26.172,+ "Every integer can be written that way."+ ],+ [+ 28.737,+ "So the rational ring goes around all the integers."+ ]+ ]+ },+ "repeat": {+ "key": "fbf10717c0e51ba0295662681a648ef7e05ae706",+ "dur": 21.36,+ "words": [+ [+ 0.078125,+ "What"+ ],+ [+ 0.14325,+ "about"+ ],+ [+ 0.481791,+ "one"+ ],+ [+ 0.872416,+ "third"+ ],+ [+ 1.783875,+ "Divide"+ ],+ [+ 2.135416,+ "one"+ ],+ [+ 2.304708,+ "by"+ ],+ [+ 2.487,+ "three"+ ],+ [+ 3.098958,+ "and"+ ],+ [+ 3.255208,+ "you"+ ],+ [+ 3.359375,+ "get"+ ],+ [+ 3.541666,+ "zero"+ ],+ [+ 3.880208,+ "point"+ ],+ [+ 4.335958,+ "three"+ ],+ [+ 4.973958,+ "three"+ ],+ [+ 5.377625,+ "three"+ ],+ [+ 6.367208,+ "and"+ ],+ [+ 6.458333,+ "the"+ ],+ [+ 6.5495,+ "threes"+ ],+ [+ 7.1745,+ "never"+ ],+ [+ 7.447916,+ "stop"+ ],+ [+ 8.346375,+ "We"+ ],+ [+ 8.463541,+ "write"+ ],+ [+ 8.697916,+ "that"+ ],+ [+ 8.958333,+ "with"+ ],+ [+ 9.075541,+ "a"+ ],+ [+ 9.114583,+ "little"+ ],+ [+ 9.348958,+ "bar"+ ],+ [+ 9.609375,+ "over"+ ],+ [+ 9.739583,+ "the"+ ],+ [+ 9.83075,+ "three"+ ],+ [+ 10.729166,+ "The"+ ],+ [+ 10.820333,+ "bar"+ ],+ [+ 11.054708,+ "means"+ ],+ [+ 11.796875,+ "this"+ ],+ [+ 11.979166,+ "part"+ ],+ [+ 12.252625,+ "repeats"+ ],+ [+ 12.7995,+ "forever"+ ],+ [+ 13.841166,+ "So"+ ],+ [+ 13.997416,+ "a"+ ],+ [+ 14.075541,+ "decimal"+ ],+ [+ 14.583333,+ "that"+ ],+ [+ 14.804708,+ "ends"+ ],+ [+ 15.559916,+ "or"+ ],+ [+ 15.729166,+ "a"+ ],+ [+ 15.833333,+ "decimal"+ ],+ [+ 16.341166,+ "that"+ ],+ [+ 16.484375,+ "repeats"+ ],+ [+ 17.617208,+ "is"+ ],+ [+ 17.747416,+ "rational"+ ],+ [+ 18.776041,+ "One"+ ],+ [+ 19.075541,+ "third"+ ],+ [+ 19.466166,+ "goes"+ ],+ [+ 19.973958,+ "in"+ ],+ [+ 20.065125,+ "the"+ ],+ [+ 20.130208,+ "rational"+ ],+ [+ 20.690125,+ "ring"+ ]+ ],+ "marks": {+ "div": 1.784,+ "bar": 8.346,+ "rule": 13.841,+ "fly": 18.776+ },+ "cues": [+ [+ 0.078,+ "What about one third?"+ ],+ [+ 1.784,+ "Divide one by three and you get zero point three three three, and the threes never stop."+ ],+ [+ 8.346,+ "We write that with a little bar over the three."+ ],+ [+ 10.729,+ "The bar means: this part repeats forever."+ ],+ [+ 13.841,+ "So a decimal that ends, or a decimal that repeats, is rational."+ ],+ [+ 18.776,+ "One third goes in the rational ring."+ ]+ ]+ },+ "irrational": {+ "key": "44731597f38d72e8e48e0dcbd09164c1d92e1285",+ "dur": 39.672,+ "words": [+ [+ 0.117208,+ "But"+ ],+ [+ 0.221375,+ "some"+ ],+ [+ 0.442708,+ "numbers"+ ],+ [+ 0.794291,+ "can't"+ ],+ [+ 1.106791,+ "be"+ ],+ [+ 1.263041,+ "written"+ ],+ [+ 1.888041,+ "as"+ ],+ [+ 2.057291,+ "a"+ ],+ [+ 2.109375,+ "fraction"+ ],+ [+ 2.591166,+ "at"+ ],+ [+ 2.669291,+ "all"+ ],+ [+ 3.359375,+ "Pi"+ ],+ [+ 3.567708,+ "is"+ ],+ [+ 3.763041,+ "three"+ ],+ [+ 4.0495,+ "point"+ ],+ [+ 4.570333,+ "one"+ ],+ [+ 4.987,+ "four"+ ],+ [+ 5.403666,+ "one"+ ],+ [+ 5.872416,+ "five"+ ],+ [+ 6.237,+ "nine"+ ],+ [+ 6.523458,+ "two"+ ],+ [+ 6.71875,+ "six"+ ],+ [+ 7.044291,+ "five"+ ],+ [+ 7.981791,+ "and"+ ],+ [+ 8.033875,+ "it"+ ],+ [+ 8.112,+ "keeps"+ ],+ [+ 8.398458,+ "going"+ ],+ [+ 8.763041,+ "with"+ ],+ [+ 8.90625,+ "no"+ ],+ [+ 9.179708,+ "block"+ ],+ [+ 9.570333,+ "of"+ ],+ [+ 9.6875,+ "digits"+ ],+ [+ 10.052083,+ "that"+ ],+ [+ 10.195333,+ "repeats"+ ],+ [+ 11.263041,+ "The square"+ ],+ [+ 11.71875,+ "root"+ ],+ [+ 11.875,+ "of"+ ],+ [+ 11.966166,+ "two"+ ],+ [+ 12.434916,+ "is"+ ],+ [+ 12.669291,+ "one"+ ],+ [+ 13.033875,+ "point"+ ],+ [+ 13.320333,+ "four"+ ],+ [+ 13.697916,+ "one"+ ],+ [+ 14.140625,+ "four"+ ],+ [+ 14.492208,+ "two"+ ],+ [+ 14.739583,+ "one"+ ],+ [+ 15.052083,+ "three"+ ],+ [+ 16.067708,+ "and"+ ],+ [+ 16.171875,+ "it"+ ],+ [+ 16.25,+ "never"+ ],+ [+ 16.536458,+ "repeats"+ ],+ [+ 17.070333,+ "either"+ ],+ [+ 17.916666,+ "These"+ ],+ [+ 18.138041,+ "are"+ ],+ [+ 18.216166,+ "irrational"+ ],+ [+ 18.815125,+ "numbers"+ ],+ [+ 19.804708,+ "Their"+ ],+ [+ 20.065125,+ "decimals"+ ],+ [+ 20.638041,+ "never"+ ],+ [+ 21.315125,+ "end"+ ],+ [+ 21.940125,+ "and"+ ],+ [+ 22.135416,+ "never"+ ],+ [+ 22.421875,+ "repeat"+ ],+ [+ 23.359375,+ "They"+ ],+ [+ 23.4245,+ "get"+ ],+ [+ 23.554708,+ "their"+ ],+ [+ 23.737,+ "own"+ ],+ [+ 23.997416,+ "ring"+ ],+ [+ 24.622416,+ "outside"+ ],+ [+ 25.2995,+ "the"+ ],+ [+ 25.351583,+ "rational"+ ],+ [+ 25.820333,+ "numbers"+ ],+ [+ 26.875,+ "A"+ ],+ [+ 26.914083,+ "number"+ ],+ [+ 27.239583,+ "is"+ ],+ [+ 27.434916,+ "rational"+ ],+ [+ 28.333333,+ "or"+ ],+ [+ 28.463541,+ "irrational"+ ],+ [+ 29.791666,+ "never"+ ],+ [+ 30.013041,+ "both"+ ],+ [+ 30.846375,+ "By"+ ],+ [+ 30.976583,+ "the"+ ],+ [+ 31.054708,+ "way"+ ],+ [+ 31.979166,+ "a"+ ],+ [+ 32.057291,+ "few"+ ],+ [+ 32.408875,+ "digits"+ ],+ [+ 32.786458,+ "can't"+ ],+ [+ 33.046875,+ "prove"+ ],+ [+ 33.294291,+ "a"+ ],+ [+ 33.333333,+ "number"+ ],+ [+ 34.114583,+ "is"+ ],+ [+ 34.244791,+ "irrational"+ ],+ [+ 35.377625,+ "Mathematicians"+ ],+ [+ 36.223958,+ "proved"+ ],+ [+ 36.627625,+ "it"+ ],+ [+ 36.744791,+ "for"+ ],+ [+ 36.901041,+ "pi"+ ],+ [+ 37.591166,+ "and"+ ],+ [+ 37.695333,+ "the"+ ],+ [+ 37.786458,+ "square"+ ],+ [+ 38.4245,+ "root"+ ],+ [+ 38.723958,+ "of"+ ],+ [+ 38.828125,+ "two"+ ]+ ],+ "marks": {+ "pi": 3.359,+ "root": 11.263,+ "ring": 17.917,+ "sep": 23.359,+ "proof": 30.846+ },+ "cues": [+ [+ 0.117,+ "But some numbers can't be written as a fraction at all."+ ],+ [+ 3.359,+ "Pi is three point one four one five nine two six five, and it keeps going, with no block of digits that repeats."+ ],+ [+ 11.263,+ "The square root of two is one point four one four two one three, and it never repeats either."+ ],+ [+ 17.917,+ "These are irrational numbers."+ ],+ [+ 19.805,+ "Their decimals never end and never repeat."+ ],+ [+ 23.359,+ "They get their own ring, outside the rational numbers."+ ],+ [+ 26.875,+ "A number is rational or irrational, never both."+ ],+ [+ 30.846,+ "By the way, a few digits can't prove a number is irrational."+ ],+ [+ 35.378,+ "Mathematicians proved it for pi and the square root of two."+ ]+ ]+ },+ "real": {+ "key": "51c9a9f7bf03f4129d1fa3afdeb2acbedeba1928",+ "dur": 17.808,+ "words": [+ [+ 0.169291,+ "Finally"+ ],+ [+ 0.9245,+ "put"+ ],+ [+ 1.08075,+ "the"+ ],+ [+ 1.184916,+ "rational"+ ],+ [+ 1.992208,+ "and"+ ],+ [+ 2.200541,+ "irrational"+ ],+ [+ 2.877625,+ "numbers"+ ],+ [+ 3.190125,+ "together"+ ],+ [+ 4.153666,+ "These"+ ],+ [+ 4.309916,+ "are"+ ],+ [+ 4.362,+ "the"+ ],+ [+ 4.453125,+ "real"+ ],+ [+ 4.817708,+ "numbers"+ ],+ [+ 5.78125,+ "every"+ ],+ [+ 6.028666,+ "number"+ ],+ [+ 6.276041,+ "you"+ ],+ [+ 6.39325,+ "can"+ ],+ [+ 6.497416,+ "find"+ ],+ [+ 6.914083,+ "on"+ ],+ [+ 6.992208,+ "a"+ ],+ [+ 7.03125,+ "number"+ ],+ [+ 7.317708,+ "line"+ ],+ [+ 8.085958,+ "Take"+ ],+ [+ 8.26825,+ "negative"+ ],+ [+ 8.658875,+ "two"+ ],+ [+ 9.427083,+ "It's"+ ],+ [+ 9.53125,+ "an"+ ],+ [+ 9.635416,+ "integer"+ ],+ [+ 10.572916,+ "so"+ ],+ [+ 10.703125,+ "it's"+ ],+ [+ 10.820333,+ "also"+ ],+ [+ 11.237,+ "rational"+ ],+ [+ 12.382833,+ "and"+ ],+ [+ 12.460958,+ "it's"+ ],+ [+ 12.617208,+ "real"+ ],+ [+ 13.476583,+ "A"+ ],+ [+ 13.528666,+ "number"+ ],+ [+ 13.89325,+ "belongs"+ ],+ [+ 14.427083,+ "to"+ ],+ [+ 14.544291,+ "its"+ ],+ [+ 14.765625,+ "own"+ ],+ [+ 15.078125,+ "ring"+ ],+ [+ 15.846375,+ "and"+ ],+ [+ 15.911458,+ "to"+ ],+ [+ 16.171875,+ "every"+ ],+ [+ 16.575541,+ "ring"+ ],+ [+ 16.835958,+ "around"+ ],+ [+ 17.226583,+ "it"+ ]+ ],+ "marks": {+ "ring": 0.924,+ "ex": 8.086,+ "int": 9.427,+ "rat": 10.573,+ "real": 12.383,+ "nest": 13.477+ },+ "cues": [+ [+ 0.169,+ "Finally, put the rational and irrational numbers together."+ ],+ [+ 4.154,+ "These are the real numbers: every number you can find on a number line."+ ],+ [+ 8.086,+ "Take negative two."+ ],+ [+ 9.427,+ "It's an integer, so it's also rational, and it's real."+ ],+ [+ 13.477,+ "A number belongs to its own ring and to every ring around it."+ ]+ ]+ },+ "q2": {+ "key": "76f47eb988c67542ba289618906995f7565199fc",+ "dur": 3.624,+ "words": [+ [+ 0.091166,+ "Quick"+ ],+ [+ 0.247416,+ "check"+ ],+ [+ 1.132833,+ "Put"+ ],+ [+ 1.289083,+ "each"+ ],+ [+ 1.497416,+ "number"+ ],+ [+ 1.953125,+ "in"+ ],+ [+ 2.057291,+ "its"+ ],+ [+ 2.213541,+ "smallest"+ ],+ [+ 2.95575,+ "ring"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.091,+ "Quick check."+ ],+ [+ 1.133,+ "Put each number in its smallest ring."+ ]+ ]+ },+ "line": {+ "key": "3ad62dce2da7717b238f432e903c819e78db47ca",+ "dur": 18.96,+ "words": [+ [+ 0.104166,+ "Now"+ ],+ [+ 0.520833,+ "let's"+ ],+ [+ 0.677083,+ "line"+ ],+ [+ 0.898458,+ "the"+ ],+ [+ 0.963541,+ "numbers"+ ],+ [+ 1.289083,+ "up"+ ],+ [+ 1.927083,+ "A"+ ],+ [+ 1.979166,+ "number"+ ],+ [+ 2.252625,+ "line"+ ],+ [+ 2.786458,+ "puts"+ ],+ [+ 3.046875,+ "numbers"+ ],+ [+ 3.4375,+ "in"+ ],+ [+ 3.528666,+ "order"+ ],+ [+ 4.362,+ "Smaller"+ ],+ [+ 4.778666,+ "numbers"+ ],+ [+ 5.117208,+ "are"+ ],+ [+ 5.221375,+ "on"+ ],+ [+ 5.338541,+ "the"+ ],+ [+ 5.403666,+ "left"+ ],+ [+ 6.263041,+ "Larger"+ ],+ [+ 6.588541,+ "numbers"+ ],+ [+ 6.901041,+ "are"+ ],+ [+ 6.979166,+ "on"+ ],+ [+ 7.096375,+ "the"+ ],+ [+ 7.148458,+ "right"+ ],+ [+ 7.95575,+ "Two"+ ],+ [+ 8.359375,+ "is"+ ],+ [+ 8.567708,+ "larger"+ ],+ [+ 9.114583,+ "than"+ ],+ [+ 9.322916,+ "one"+ ],+ [+ 9.882833,+ "and"+ ],+ [+ 10.091166,+ "larger"+ ],+ [+ 10.520833,+ "than"+ ],+ [+ 10.638041,+ "zero"+ ],+ [+ 11.588541,+ "so"+ ],+ [+ 11.692708,+ "it"+ ],+ [+ 11.757833,+ "sits"+ ],+ [+ 11.979166,+ "to"+ ],+ [+ 12.083333,+ "their"+ ],+ [+ 12.278666,+ "right"+ ],+ [+ 13.033875,+ "Negative"+ ],+ [+ 13.4245,+ "three"+ ],+ [+ 14.140625,+ "is"+ ],+ [+ 14.296875,+ "smaller"+ ],+ [+ 14.908875,+ "than"+ ],+ [+ 15.091166,+ "negative"+ ],+ [+ 15.520833,+ "two"+ ],+ [+ 16.132833,+ "and"+ ],+ [+ 16.315125,+ "negative"+ ],+ [+ 16.757833,+ "one"+ ],+ [+ 17.434916,+ "so"+ ],+ [+ 17.565125,+ "it"+ ],+ [+ 17.630208,+ "sits"+ ],+ [+ 17.864583,+ "to"+ ],+ [+ 17.95575,+ "their"+ ],+ [+ 18.125,+ "left"+ ]+ ],+ "marks": {+ "line": 1.927,+ "dir": 4.362,+ "two": 7.956,+ "three": 13.034+ },+ "cues": [+ [+ 0.104,+ "Now let's line the numbers up."+ ],+ [+ 1.927,+ "A number line puts numbers in order."+ ],+ [+ 4.362,+ "Smaller numbers are on the left."+ ],+ [+ 6.263,+ "Larger numbers are on the right."+ ],+ [+ 7.956,+ "Two is larger than one and larger than zero, so it sits to their right."+ ],+ [+ 13.034,+ "Negative three is smaller than negative two and negative one, so it sits to their left."+ ]+ ]+ },+ "place": {+ "key": "6cd8d69c91137a68bbeeda654c9fd3da69f31dfa",+ "dur": 32.712,+ "words": [+ [+ 0.104166,+ "Every"+ ],+ [+ 0.325541,+ "rational"+ ],+ [+ 0.78125,+ "number"+ ],+ [+ 1.223958,+ "has"+ ],+ [+ 1.40625,+ "a"+ ],+ [+ 1.471375,+ "spot"+ ],+ [+ 2.487,+ "not"+ ],+ [+ 2.773458,+ "just"+ ],+ [+ 2.994791,+ "the"+ ],+ [+ 3.059916,+ "integers"+ ],+ [+ 4.140625,+ "Negative"+ ],+ [+ 4.51825,+ "two"+ ],+ [+ 4.765625,+ "point"+ ],+ [+ 5.3125,+ "three"+ ],+ [+ 5.963541,+ "eight"+ ],+ [+ 6.445333,+ "sits"+ ],+ [+ 6.653666,+ "a"+ ],+ [+ 6.70575,+ "little"+ ],+ [+ 7.03125,+ "past"+ ],+ [+ 7.630208,+ "negative"+ ],+ [+ 8.072916,+ "two"+ ],+ [+ 8.89325,+ "Negative"+ ],+ [+ 9.270833,+ "three"+ ],+ [+ 9.583333,+ "fourths"+ ],+ [+ 10.442708,+ "is"+ ],+ [+ 10.546875,+ "between"+ ],+ [+ 10.9375,+ "negative"+ ],+ [+ 11.40625,+ "one"+ ],+ [+ 11.966166,+ "and"+ ],+ [+ 12.122416,+ "zero"+ ],+ [+ 13.125,+ "One"+ ],+ [+ 13.307291,+ "half"+ ],+ [+ 13.710958,+ "is"+ ],+ [+ 13.828125,+ "halfway"+ ],+ [+ 14.427083,+ "from"+ ],+ [+ 14.622416,+ "zero"+ ],+ [+ 15.013041,+ "to"+ ],+ [+ 15.091166,+ "one"+ ],+ [+ 15.833333,+ "And"+ ],+ [+ 15.898458,+ "the"+ ],+ [+ 15.963541,+ "square"+ ],+ [+ 16.510416,+ "root"+ ],+ [+ 16.71875,+ "of"+ ],+ [+ 16.835958,+ "four"+ ],+ [+ 17.669291,+ "It"+ ],+ [+ 17.747416,+ "looks"+ ],+ [+ 17.929708,+ "irrational"+ ],+ [+ 19.0625,+ "but"+ ],+ [+ 19.179708,+ "it's"+ ],+ [+ 19.296875,+ "exactly"+ ],+ [+ 19.973958,+ "two"+ ],+ [+ 20.950541,+ "Three"+ ],+ [+ 21.237,+ "and"+ ],+ [+ 21.367208,+ "one"+ ],+ [+ 21.575541,+ "eighth"+ ],+ [+ 22.291666,+ "is"+ ],+ [+ 22.408875,+ "just"+ ],+ [+ 22.578125,+ "past"+ ],+ [+ 22.903666,+ "three"+ ],+ [+ 23.723958,+ "Irrational"+ ],+ [+ 24.192708,+ "numbers"+ ],+ [+ 24.557291,+ "have"+ ],+ [+ 24.6875,+ "spots"+ ],+ [+ 25.091166,+ "too"+ ],+ [+ 25.885416,+ "The square"+ ],+ [+ 26.341166,+ "root"+ ],+ [+ 26.471375,+ "of"+ ],+ [+ 26.5495,+ "two"+ ],+ [+ 27.161458,+ "is"+ ],+ [+ 27.291666,+ "about"+ ],+ [+ 27.630208,+ "one"+ ],+ [+ 27.916666,+ "point"+ ],+ [+ 28.190125,+ "four"+ ],+ [+ 28.476583,+ "one"+ ],+ [+ 29.192708,+ "Together"+ ],+ [+ 30.039083,+ "the"+ ],+ [+ 30.117208,+ "real"+ ],+ [+ 30.46875,+ "numbers"+ ],+ [+ 31.106791,+ "fill"+ ],+ [+ 31.588541,+ "the"+ ],+ [+ 31.679708,+ "whole"+ ],+ [+ 31.940125,+ "line"+ ]+ ],+ "marks": {+ "f1": 2.487,+ "a": 4.141,+ "b": 8.893,+ "c": 13.125,+ "d": 15.833,+ "e": 20.951,+ "irr": 23.724,+ "all": 29.193+ },+ "cues": [+ [+ 0.104,+ "Every rational number has a spot, not just the integers."+ ],+ [+ 4.141,+ "Negative two point three eight sits a little past negative two."+ ],+ [+ 8.893,+ "Negative three fourths is between negative one and zero."+ ],+ [+ 13.125,+ "One half is halfway from zero to one."+ ],+ [+ 15.833,+ "And the square root of four?"+ ],+ [+ 17.669,+ "It looks irrational, but it's exactly two."+ ],+ [+ 20.951,+ "Three and one eighth is just past three."+ ],+ [+ 23.724,+ "Irrational numbers have spots too."+ ],+ [+ 25.885,+ "The square root of two is about one point four one."+ ],+ [+ 29.193,+ "Together, the real numbers fill the whole line."+ ]+ ]+ },+ "q3": {+ "key": "e3d5585abcb9c49712cbca70a21ecb97f6ad578c",+ "dur": 3.048,+ "words": [+ [+ 0.104166,+ "Quick"+ ],+ [+ 0.260416,+ "check"+ ],+ [+ 1.171875,+ "Find"+ ],+ [+ 1.354166,+ "the"+ ],+ [+ 1.419291,+ "points"+ ],+ [+ 1.979166,+ "on"+ ],+ [+ 2.044291,+ "the"+ ],+ [+ 2.109375,+ "number"+ ],+ [+ 2.317708,+ "line"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.172,+ "Find the points on the number line."+ ]+ ]+ },+ "wrap": {+ "key": "e0e26264a5c079f237ee5dd867a478bfbbbb4621",+ "dur": 28.92,+ "words": [+ [+ 0.104166,+ "To"+ ],+ [+ 0.15625,+ "sum"+ ],+ [+ 0.364583,+ "up"+ ],+ [+ 1.002625,+ "Each"+ ],+ [+ 1.197916,+ "family"+ ],+ [+ 1.679708,+ "adds"+ ],+ [+ 2.005208,+ "new"+ ],+ [+ 2.265625,+ "numbers"+ ],+ [+ 3.307291,+ "zero"+ ],+ [+ 3.776041,+ "for"+ ],+ [+ 3.880208,+ "the"+ ],+ [+ 3.958333,+ "whole"+ ],+ [+ 4.270833,+ "numbers"+ ],+ [+ 5.013041,+ "negatives"+ ],+ [+ 5.612,+ "for"+ ],+ [+ 5.742208,+ "the"+ ],+ [+ 5.846375,+ "integers"+ ],+ [+ 6.770833,+ "fractions"+ ],+ [+ 7.382833,+ "for"+ ],+ [+ 7.460958,+ "the"+ ],+ [+ 7.513041,+ "rationals"+ ],+ [+ 8.737,+ "Rational"+ ],+ [+ 9.140625,+ "numbers"+ ],+ [+ 9.778666,+ "can"+ ],+ [+ 9.921875,+ "be"+ ],+ [+ 10.14325,+ "written"+ ],+ [+ 10.690125,+ "as"+ ],+ [+ 10.846375,+ "a"+ ],+ [+ 10.898458,+ "fraction"+ ],+ [+ 11.953125,+ "Their"+ ],+ [+ 12.096375,+ "decimals"+ ],+ [+ 12.929708,+ "end"+ ],+ [+ 13.58075,+ "or"+ ],+ [+ 13.737,+ "repeat"+ ],+ [+ 14.6745,+ "Irrational"+ ],+ [+ 15.221375,+ "decimals"+ ],+ [+ 15.794291,+ "never"+ ],+ [+ 16.432291,+ "end"+ ],+ [+ 17.096375,+ "and"+ ],+ [+ 17.33075,+ "never"+ ],+ [+ 17.64325,+ "repeat"+ ],+ [+ 18.58075,+ "Rational"+ ],+ [+ 19.453125,+ "and"+ ],+ [+ 19.622416,+ "irrational"+ ],+ [+ 20.3125,+ "together"+ ],+ [+ 21.054708,+ "make"+ ],+ [+ 21.315125,+ "the"+ ],+ [+ 21.40625,+ "real"+ ],+ [+ 21.757833,+ "numbers"+ ],+ [+ 22.721375,+ "On"+ ],+ [+ 22.8125,+ "a"+ ],+ [+ 22.851583,+ "number"+ ],+ [+ 23.164083,+ "line"+ ],+ [+ 23.919291,+ "smaller"+ ],+ [+ 24.388041,+ "is"+ ],+ [+ 24.544291,+ "left"+ ],+ [+ 25.065125,+ "and"+ ],+ [+ 25.195333,+ "larger"+ ],+ [+ 25.78125,+ "is"+ ],+ [+ 25.911458,+ "right"+ ],+ [+ 26.796875,+ "Now"+ ],+ [+ 27.1745,+ "try"+ ],+ [+ 27.369791,+ "the"+ ],+ [+ 27.447916,+ "chapter"+ ],+ [+ 27.864583,+ "practice"+ ]+ ],+ "marks": {+ "w1": 1.003,+ "w2": 8.737,+ "w3": 14.675,+ "w4": 22.721,+ "end": 26.797+ },+ "cues": [+ [+ 0.104,+ "To sum up."+ ],+ [+ 1.003,+ "Each family adds new numbers: zero for the whole numbers, negatives for the integers, fractions for the rationals."+ ],+ [+ 8.737,+ "Rational numbers can be written as a fraction."+ ],+ [+ 11.953,+ "Their decimals end or repeat."+ ],+ [+ 14.675,+ "Irrational decimals never end and never repeat."+ ],+ [+ 18.581,+ "Rational and irrational together make the real numbers."+ ],+ [+ 22.721,+ "On a number line, smaller is left and larger is right."+ ],+ [+ 26.797,+ "Now try the chapter practice."+ ]+ ]+ },+ "final1": {+ "key": "62efd6c5cef7749bcb822d67051bff87a6b5eb01",+ "dur": 5.496,+ "words": [+ [+ 0.104166,+ "Chapter"+ ],+ [+ 0.416666,+ "practice"+ ],+ [+ 1.523458,+ "Classify"+ ],+ [+ 2.34375,+ "each"+ ],+ [+ 2.578125,+ "number"+ ],+ [+ 2.96875,+ "in"+ ],+ [+ 3.294291,+ "every"+ ],+ [+ 3.632833,+ "family"+ ],+ [+ 4.114583,+ "it"+ ],+ [+ 4.192708,+ "belongs"+ ],+ [+ 4.726583,+ "to"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Chapter practice."+ ],+ [+ 1.523,+ "Classify each number in every family it belongs to."+ ]+ ]+ },+ "final2": {+ "key": "117729b69bd966ab5620f012e86af21e83355dbb",+ "dur": 2.04,+ "words": [+ [+ 0.130208,+ "Four"+ ],+ [+ 0.221375,+ "more"+ ],+ [+ 0.442708,+ "numbers"+ ],+ [+ 0.78125,+ "to"+ ],+ [+ 0.885416,+ "classify"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.13,+ "Four more numbers to classify."+ ]+ ]+ },+ "final3": {+ "key": "e2b7a5d249395d6a5f83a4425d194b68ed8f8f1a",+ "dur": 3.0,+ "words": [+ [+ 0.091166,+ "Last"+ ],+ [+ 0.377625,+ "one"+ ],+ [+ 1.08075,+ "Left"+ ],+ [+ 1.692708,+ "or"+ ],+ [+ 1.862,+ "right"+ ],+ [+ 2.057291,+ "of"+ ],+ [+ 2.122416,+ "zero"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.091,+ "Last one."+ ],+ [+ 1.081,+ "Left or right of zero?"+ ]+ ]+ },+ "finish": {+ "key": "94b4bdcd82ec7aaa98240daa35f2b8569e6f5236",+ "dur": 2.904,+ "words": [+ [+ 0.091166,+ "Nice"+ ],+ [+ 0.364583,+ "work"+ ],+ [+ 1.197916,+ "That's"+ ],+ [+ 1.380208,+ "the"+ ],+ [+ 1.484375,+ "end"+ ],+ [+ 1.71875,+ "of"+ ],+ [+ 1.796875,+ "chapter"+ ],+ [+ 2.265625,+ "one"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.091,+ "Nice work."+ ],+ [+ 1.198,+ "That's the end of chapter one."+ ]+ ]+ }+}\ No newline at end of filediff --git a/content/math-notebook/ch02/narration.en.json b/content/math-notebook/ch02/narration.en.jsonnew file mode 100644index 0000000..b242059--- /dev/null+++ b/content/math-notebook/ch02/narration.en.json@@ -0,0 +1,22 @@+{+ "voice": "en-US-AndrewMultilingualNeural",+ "rate": "-4%",+ "beats": {+ "intro": "Chapter two. Positive and negative numbers. [[sub]]Every number except zero sits on one side of zero or the other.",+ "sides": "Here's the number line again, this time from negative eight to eight. [[zero]]Zero sits right in the middle. Zero is neither positive nor negative. It's the dividing point. [[pos]]Numbers greater than zero are positive. On a number line, they're to the right of zero. [[neg]]Numbers less than zero are negative. They're to the left. [[mirror]]The two sides mirror each other, with zero in between.",+ "signs": "How can you tell them apart when they're written down? [[plus]]A positive number can have a plus sign, but it doesn't need one. [[same]]Plus four and four mean exactly the same thing. [[minus]]A negative number always has a minus sign in front: negative four. [[need]]Leave that sign off, and you've written a different number. [[ends]]Now look at the arrows on the ends. [[inf]]They mean the numbers keep going forever: to infinity on the right, [[ninf]]and to negative infinity on the left. [[word]]Infinity means endless, without any limit.",+ "q1": "Quick check. Is each number positive, negative, or neither?",+ "world": "Why do we need negative numbers at all? [[use]]Because lots of things in the world come in opposite pairs. [[r1]]Money you owe, a debt, is negative. Money you keep, your savings, is positive. [[r2]]Temperatures below zero are negative. Above zero, positive. [[r3]]Below sea level is negative. Above sea level is positive. [[r4]]Money taken out of a bank account is negative. Money put in is positive. [[r5]]Even electric charges come in negative and positive. [[pair]]In every pair, zero is the starting point, and the two sides go in opposite directions.",+ "owe": "Let's try one. [[story]]Devin borrows two dollars from his friend Stanley. [[coins]]Stanley hands over the money. [[owes]]Now Devin owes two dollars. Owing is a debt, so it's negative: [[neg]]negative two. [[pos]]For Stanley, it's the other way around. He is owed two dollars: positive two.",+ "q2": "Quick check. Find each amount on the number line.",+ "vertical": "A number line doesn't have to lie flat. [[up]]Stand it up, and you get a thermometer. [[warm]]On a warm day it might be twenty degrees: positive twenty. [[drop]]When the temperature falls to ten degrees below zero, [[cold]]that's negative ten. [[sea]]Heights work the same way, with sea level as zero. [[gull]]A gull thirty feet above the water is at positive thirty. [[sub]]A submarine thirty feet below is at negative thirty. [[rule]]On an upright number line, above zero is positive, and below zero is negative.",+ "opposites": "Look at five and negative five. [[five]]Five is five steps to the right of zero. [[nfive]]Negative five is five steps to the left. [[opp]]Same distance from zero, opposite sides. Numbers like these are called opposites. [[flip]]To find a number's opposite, flip it across zero. [[eight]]What's the opposite of eight? Flip it: negative eight. [[zero]]And zero is its own opposite, because flipping doesn't move it.",+ "oppopp": "Now flip twice. [[start]]Start with negative six. [[first]]Its opposite is six. [[second]]Now take the opposite of six, and you're back at negative six. [[rule]]This is the opposites of opposites property. The opposite of the opposite of a number is the number itself. [[home]]Two flips always bring you home.",+ "q3": "Quick check. Flip across zero.",+ "wrap": "To sum up. [[w1]]Positive numbers are greater than zero, negative numbers are less than zero, and zero is neither. [[w2]]A negative number always shows its minus sign. A plus sign is optional. [[w3]]Opposite quantities, like owing and saving, or below and above, get opposite signs. [[w4]]Opposites are the same distance from zero, on opposite sides. And the opposite of the opposite is the number itself. [[end]]Now try the chapter practice.",+ "final1": "Chapter practice. Write the integer for each quantity.",+ "final2": "Now find the opposites.",+ "final3": "Last one. True or false?",+ "finish": "Great job. That's the end of chapter two."+ }+}diff --git a/content/math-notebook/ch02/narration.en.timings.json b/content/math-notebook/ch02/narration.en.timings.jsonnew file mode 100644index 0000000..c2cb9c1--- /dev/null+++ b/content/math-notebook/ch02/narration.en.timings.json@@ -0,0 +1,3004 @@+{+ "intro": {+ "key": "c01237ced43a7d94a8e8d9d0da1404082d9a3838",+ "dur": 8.52,+ "words": [+ [+ 0.104166,+ "Chapter"+ ],+ [+ 0.45575,+ "two"+ ],+ [+ 1.210958,+ "Positive"+ ],+ [+ 1.914083,+ "and"+ ],+ [+ 2.057291,+ "negative"+ ],+ [+ 2.421875,+ "numbers"+ ],+ [+ 3.411458,+ "Every"+ ],+ [+ 3.606791,+ "number"+ ],+ [+ 3.880208,+ "except"+ ],+ [+ 4.427083,+ "zero"+ ],+ [+ 5.403666,+ "sits"+ ],+ [+ 5.703125,+ "on"+ ],+ [+ 5.872416,+ "one"+ ],+ [+ 6.132833,+ "side"+ ],+ [+ 6.445333,+ "of"+ ],+ [+ 6.510416,+ "zero"+ ],+ [+ 7.473958,+ "or"+ ],+ [+ 7.604166,+ "the"+ ],+ [+ 7.747416,+ "other"+ ]+ ],+ "marks": {+ "sub": 3.411+ },+ "cues": [+ [+ 0.104,+ "Chapter two."+ ],+ [+ 1.211,+ "Positive and negative numbers."+ ],+ [+ 3.411,+ "Every number except zero sits on one side of zero or the other."+ ]+ ]+ },+ "sides": {+ "key": "850b0a3d661dd42752920b306cad9fe6d87f2ce1",+ "dur": 24.0,+ "words": [+ [+ 0.117208,+ "Here's"+ ],+ [+ 0.2995,+ "the"+ ],+ [+ 0.377625,+ "number"+ ],+ [+ 0.651041,+ "line"+ ],+ [+ 0.898458,+ "again"+ ],+ [+ 1.653666,+ "this"+ ],+ [+ 1.796875,+ "time"+ ],+ [+ 2.03125,+ "from"+ ],+ [+ 2.200541,+ "negative"+ ],+ [+ 2.773458,+ "eight"+ ],+ [+ 3.216166,+ "to"+ ],+ [+ 3.359375,+ "eight"+ ],+ [+ 4.244791,+ "Zero"+ ],+ [+ 4.609375,+ "sits"+ ],+ [+ 4.921875,+ "right"+ ],+ [+ 5.260416,+ "in"+ ],+ [+ 5.325541,+ "the"+ ],+ [+ 5.390625,+ "middle"+ ],+ [+ 6.158875,+ "Zero"+ ],+ [+ 6.679708,+ "is"+ ],+ [+ 6.835958,+ "neither"+ ],+ [+ 7.1875,+ "positive"+ ],+ [+ 8.046875,+ "nor"+ ],+ [+ 8.216166,+ "negative"+ ],+ [+ 9.192708,+ "It's"+ ],+ [+ 9.270833,+ "the"+ ],+ [+ 9.348958,+ "dividing"+ ],+ [+ 9.778666,+ "point"+ ],+ [+ 10.625,+ "Numbers"+ ],+ [+ 10.9375,+ "greater"+ ],+ [+ 11.276041,+ "than"+ ],+ [+ 11.39325,+ "zero"+ ],+ [+ 12.1875,+ "are"+ ],+ [+ 12.317708,+ "positive"+ ],+ [+ 13.4375,+ "On"+ ],+ [+ 13.528666,+ "a"+ ],+ [+ 13.554708,+ "number"+ ],+ [+ 13.89325,+ "line"+ ],+ [+ 14.856791,+ "they're"+ ],+ [+ 15.0,+ "to"+ ],+ [+ 15.130208,+ "the"+ ],+ [+ 15.208333,+ "right"+ ],+ [+ 15.520833,+ "of"+ ],+ [+ 15.585958,+ "zero"+ ],+ [+ 16.575541,+ "Numbers"+ ],+ [+ 16.888041,+ "less"+ ],+ [+ 17.096375,+ "than"+ ],+ [+ 17.226583,+ "zero"+ ],+ [+ 17.903666,+ "are"+ ],+ [+ 18.085958,+ "negative"+ ],+ [+ 19.21875,+ "They're"+ ],+ [+ 19.348958,+ "to"+ ],+ [+ 19.427083,+ "the"+ ],+ [+ 19.51825,+ "left"+ ],+ [+ 20.364583,+ "The"+ ],+ [+ 20.429708,+ "two"+ ],+ [+ 20.638041,+ "sides"+ ],+ [+ 21.08075,+ "mirror"+ ],+ [+ 21.536458,+ "each"+ ],+ [+ 21.731791,+ "other"+ ],+ [+ 22.369791,+ "with"+ ],+ [+ 22.513041,+ "zero"+ ],+ [+ 23.020833,+ "in"+ ],+ [+ 23.112,+ "between"+ ]+ ],+ "marks": {+ "zero": 4.245,+ "pos": 10.625,+ "neg": 16.576,+ "mirror": 20.365+ },+ "cues": [+ [+ 0.117,+ "Here's the number line again, this time from negative eight to eight."+ ],+ [+ 4.245,+ "Zero sits right in the middle."+ ],+ [+ 6.159,+ "Zero is neither positive nor negative."+ ],+ [+ 9.193,+ "It's the dividing point."+ ],+ [+ 10.625,+ "Numbers greater than zero are positive."+ ],+ [+ 13.438,+ "On a number line, they're to the right of zero."+ ],+ [+ 16.576,+ "Numbers less than zero are negative."+ ],+ [+ 19.219,+ "They're to the left."+ ],+ [+ 20.365,+ "The two sides mirror each other, with zero in between."+ ]+ ]+ },+ "signs": {+ "key": "bbed069b21af8b594f6f20256d32c3ab8ccbda99",+ "dur": 29.448,+ "words": [+ [+ 0.104166,+ "How"+ ],+ [+ 0.182291,+ "can"+ ],+ [+ 0.286458,+ "you"+ ],+ [+ 0.377625,+ "tell"+ ],+ [+ 0.546875,+ "them"+ ],+ [+ 0.651041,+ "apart"+ ],+ [+ 1.289083,+ "when"+ ],+ [+ 1.419291,+ "they're"+ ],+ [+ 1.575541,+ "written"+ ],+ [+ 1.744791,+ "down"+ ],+ [+ 2.578125,+ "A"+ ],+ [+ 2.617208,+ "positive"+ ],+ [+ 3.033875,+ "number"+ ],+ [+ 3.294291,+ "can"+ ],+ [+ 3.398458,+ "have"+ ],+ [+ 3.619791,+ "a"+ ],+ [+ 3.684916,+ "plus"+ ],+ [+ 4.036458,+ "sign"+ ],+ [+ 4.817708,+ "but"+ ],+ [+ 4.934916,+ "it"+ ],+ [+ 5.039083,+ "doesn't"+ ],+ [+ 5.351583,+ "need"+ ],+ [+ 5.559916,+ "one"+ ],+ [+ 6.289083,+ "Plus"+ ],+ [+ 6.497416,+ "four"+ ],+ [+ 6.862,+ "and"+ ],+ [+ 6.966166,+ "four"+ ],+ [+ 7.304708,+ "mean"+ ],+ [+ 7.578125,+ "exactly"+ ],+ [+ 8.151041,+ "the"+ ],+ [+ 8.242208,+ "same"+ ],+ [+ 8.541666,+ "thing"+ ],+ [+ 9.296875,+ "A"+ ],+ [+ 9.335958,+ "negative"+ ],+ [+ 9.739583,+ "number"+ ],+ [+ 10.14325,+ "always"+ ],+ [+ 10.585958,+ "has"+ ],+ [+ 10.755208,+ "a"+ ],+ [+ 10.794291,+ "minus"+ ],+ [+ 11.302083,+ "sign"+ ],+ [+ 11.575541,+ "in"+ ],+ [+ 11.666666,+ "front"+ ],+ [+ 12.630208,+ "negative"+ ],+ [+ 13.033875,+ "four"+ ],+ [+ 13.89325,+ "Leave"+ ],+ [+ 14.114583,+ "that"+ ],+ [+ 14.283875,+ "sign"+ ],+ [+ 14.622416,+ "off"+ ],+ [+ 15.3125,+ "and"+ ],+ [+ 15.390625,+ "you've"+ ],+ [+ 15.559916,+ "written"+ ],+ [+ 15.742208,+ "a"+ ],+ [+ 15.807291,+ "different"+ ],+ [+ 16.106791,+ "number"+ ],+ [+ 16.914083,+ "Now"+ ],+ [+ 17.070333,+ "look"+ ],+ [+ 17.213541,+ "at"+ ],+ [+ 17.265625,+ "the"+ ],+ [+ 17.34375,+ "arrows"+ ],+ [+ 17.8125,+ "on"+ ],+ [+ 17.903666,+ "the"+ ],+ [+ 17.95575,+ "ends"+ ],+ [+ 19.023458,+ "They"+ ],+ [+ 19.101583,+ "mean"+ ],+ [+ 19.231791,+ "the"+ ],+ [+ 19.296875,+ "numbers"+ ],+ [+ 19.752625,+ "keep"+ ],+ [+ 20.026041,+ "going"+ ],+ [+ 20.403666,+ "forever"+ ],+ [+ 21.419291,+ "to"+ ],+ [+ 21.588541,+ "infinity"+ ],+ [+ 22.1875,+ "on"+ ],+ [+ 22.291666,+ "the"+ ],+ [+ 22.356791,+ "right"+ ],+ [+ 23.242208,+ "and"+ ],+ [+ 23.359375,+ "to"+ ],+ [+ 23.463541,+ "negative"+ ],+ [+ 24.010416,+ "infinity"+ ],+ [+ 24.700541,+ "on"+ ],+ [+ 24.83075,+ "the"+ ],+ [+ 24.882833,+ "left"+ ],+ [+ 25.794291,+ "Infinity"+ ],+ [+ 26.445333,+ "means"+ ],+ [+ 27.135416,+ "endless"+ ],+ [+ 28.007833,+ "without"+ ],+ [+ 28.4375,+ "any"+ ],+ [+ 28.606791,+ "limit"+ ]+ ],+ "marks": {+ "plus": 2.578,+ "same": 6.289,+ "minus": 9.297,+ "need": 13.893,+ "ends": 16.914,+ "inf": 19.023,+ "ninf": 23.242,+ "word": 25.794+ },+ "cues": [+ [+ 0.104,+ "How can you tell them apart when they're written down?"+ ],+ [+ 2.578,+ "A positive number can have a plus sign, but it doesn't need one."+ ],+ [+ 6.289,+ "Plus four and four mean exactly the same thing."+ ],+ [+ 9.297,+ "A negative number always has a minus sign in front: negative four."+ ],+ [+ 13.893,+ "Leave that sign off, and you've written a different number."+ ],+ [+ 16.914,+ "Now look at the arrows on the ends."+ ],+ [+ 19.023,+ "They mean the numbers keep going forever: to infinity on the right, and to negative infinity on the left."+ ],+ [+ 25.794,+ "Infinity means endless, without any limit."+ ]+ ]+ },+ "q1": {+ "key": "2747142bf170d447116af1b0d65b06fa0589f297",+ "dur": 4.656,+ "words": [+ [+ 0.104166,+ "Quick"+ ],+ [+ 0.260416,+ "check"+ ],+ [+ 1.145833,+ "Is"+ ],+ [+ 1.302083,+ "each"+ ],+ [+ 1.497416,+ "number"+ ],+ [+ 1.731791,+ "positive"+ ],+ [+ 2.760416,+ "negative"+ ],+ [+ 3.619791,+ "or"+ ],+ [+ 3.75,+ "neither"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.146,+ "Is each number positive, negative, or neither?"+ ]+ ]+ },+ "world": {+ "key": "6caa45749034f8b7f623bddc87da169f48c84344",+ "dur": 35.352,+ "words": [+ [+ 0.104166,+ "Why"+ ],+ [+ 0.208333,+ "do"+ ],+ [+ 0.273458,+ "we"+ ],+ [+ 0.364583,+ "need"+ ],+ [+ 0.703125,+ "negative"+ ],+ [+ 1.145833,+ "numbers"+ ],+ [+ 1.484375,+ "at"+ ],+ [+ 1.5625,+ "all"+ ],+ [+ 2.304708,+ "Because"+ ],+ [+ 2.591166,+ "lots"+ ],+ [+ 2.890625,+ "of"+ ],+ [+ 2.95575,+ "things"+ ],+ [+ 3.26825,+ "in"+ ],+ [+ 3.320333,+ "the"+ ],+ [+ 3.385416,+ "world"+ ],+ [+ 3.737,+ "come"+ ],+ [+ 3.880208,+ "in"+ ],+ [+ 3.958333,+ "opposite"+ ],+ [+ 4.427083,+ "pairs"+ ],+ [+ 5.416666,+ "Money"+ ],+ [+ 5.664083,+ "you"+ ],+ [+ 5.859375,+ "owe"+ ],+ [+ 6.471375,+ "a"+ ],+ [+ 6.588541,+ "debt"+ ],+ [+ 6.940125,+ "is"+ ],+ [+ 7.057291,+ "negative"+ ],+ [+ 8.046875,+ "Money"+ ],+ [+ 8.320333,+ "you"+ ],+ [+ 8.450541,+ "keep"+ ],+ [+ 9.127625,+ "your"+ ],+ [+ 9.270833,+ "savings"+ ],+ [+ 10.0,+ "is"+ ],+ [+ 10.182291,+ "positive"+ ],+ [+ 11.39325,+ "Temperatures"+ ],+ [+ 11.875,+ "below"+ ],+ [+ 12.356791,+ "zero"+ ],+ [+ 13.177083,+ "are"+ ],+ [+ 13.320333,+ "negative"+ ],+ [+ 14.427083,+ "Above"+ ],+ [+ 14.765625,+ "zero"+ ],+ [+ 15.612,+ "positive"+ ],+ [+ 16.692708,+ "Below"+ ],+ [+ 16.992208,+ "sea"+ ],+ [+ 17.239583,+ "level"+ ],+ [+ 17.578125,+ "is"+ ],+ [+ 17.708333,+ "negative"+ ],+ [+ 18.841166,+ "Above"+ ],+ [+ 19.179708,+ "sea"+ ],+ [+ 19.466166,+ "level"+ ],+ [+ 19.765625,+ "is"+ ],+ [+ 19.869791,+ "positive"+ ],+ [+ 21.054708,+ "Money"+ ],+ [+ 21.263041,+ "taken"+ ],+ [+ 21.70575,+ "out"+ ],+ [+ 21.822916,+ "of"+ ],+ [+ 21.862,+ "a"+ ],+ [+ 21.914083,+ "bank"+ ],+ [+ 22.252625,+ "account"+ ],+ [+ 22.916666,+ "is"+ ],+ [+ 23.059916,+ "negative"+ ],+ [+ 24.244791,+ "Money"+ ],+ [+ 24.440125,+ "put"+ ],+ [+ 24.609375,+ "in"+ ],+ [+ 24.6745,+ "is"+ ],+ [+ 24.778666,+ "positive"+ ],+ [+ 25.911458,+ "Even"+ ],+ [+ 26.09375,+ "electric"+ ],+ [+ 26.445333,+ "charges"+ ],+ [+ 26.888041,+ "come"+ ],+ [+ 27.070333,+ "in"+ ],+ [+ 27.213541,+ "negative"+ ],+ [+ 27.695333,+ "and"+ ],+ [+ 27.786458,+ "positive"+ ],+ [+ 28.932291,+ "In"+ ],+ [+ 29.0625,+ "every"+ ],+ [+ 29.388041,+ "pair"+ ],+ [+ 30.338541,+ "zero"+ ],+ [+ 31.184916,+ "is"+ ],+ [+ 31.341166,+ "the"+ ],+ [+ 31.40625,+ "starting"+ ],+ [+ 31.862,+ "point"+ ],+ [+ 32.734375,+ "and"+ ],+ [+ 32.786458,+ "the"+ ],+ [+ 32.877625,+ "two"+ ],+ [+ 33.125,+ "sides"+ ],+ [+ 33.567708,+ "go"+ ],+ [+ 33.763041,+ "in"+ ],+ [+ 33.841166,+ "opposite"+ ],+ [+ 34.244791,+ "directions"+ ]+ ],+ "marks": {+ "use": 2.305,+ "r1": 5.417,+ "r2": 11.393,+ "r3": 16.693,+ "r4": 21.055,+ "r5": 25.911,+ "pair": 28.932+ },+ "cues": [+ [+ 0.104,+ "Why do we need negative numbers at all?"+ ],+ [+ 2.305,+ "Because lots of things in the world come in opposite pairs."+ ],+ [+ 5.417,+ "Money you owe, a debt, is negative."+ ],+ [+ 8.047,+ "Money you keep, your savings, is positive."+ ],+ [+ 11.393,+ "Temperatures below zero are negative."+ ],+ [+ 14.427,+ "Above zero, positive."+ ],+ [+ 16.693,+ "Below sea level is negative."+ ],+ [+ 18.841,+ "Above sea level is positive."+ ],+ [+ 21.055,+ "Money taken out of a bank account is negative."+ ],+ [+ 24.245,+ "Money put in is positive."+ ],+ [+ 25.911,+ "Even electric charges come in negative and positive."+ ],+ [+ 28.932,+ "In every pair, zero is the starting point, and the two sides go in opposite directions."+ ]+ ]+ },+ "owe": {+ "key": "2f4d046c6a3c05b8b70f4afbdf402f98caf20049",+ "dur": 17.856,+ "words": [+ [+ 0.104166,+ "Let's"+ ],+ [+ 0.208333,+ "try"+ ],+ [+ 0.429708,+ "one"+ ],+ [+ 1.158875,+ "Devin"+ ],+ [+ 1.380208,+ "borrows"+ ],+ [+ 2.01825,+ "two"+ ],+ [+ 2.33075,+ "dollars"+ ],+ [+ 2.747416,+ "from"+ ],+ [+ 2.877625,+ "his"+ ],+ [+ 2.981791,+ "friend"+ ],+ [+ 3.28125,+ "Stanley"+ ],+ [+ 4.244791,+ "Stanley"+ ],+ [+ 4.648458,+ "hands"+ ],+ [+ 5.273458,+ "over"+ ],+ [+ 5.442708,+ "the"+ ],+ [+ 5.507833,+ "money"+ ],+ [+ 6.302083,+ "Now"+ ],+ [+ 6.666666,+ "Devin"+ ],+ [+ 7.01825,+ "owes"+ ],+ [+ 7.278666,+ "two"+ ],+ [+ 7.526041,+ "dollars"+ ],+ [+ 8.619791,+ "Owing"+ ],+ [+ 8.841166,+ "is"+ ],+ [+ 8.932291,+ "a"+ ],+ [+ 9.010416,+ "debt"+ ],+ [+ 9.648458,+ "so"+ ],+ [+ 9.83075,+ "it's"+ ],+ [+ 9.960958,+ "negative"+ ],+ [+ 11.002625,+ "negative"+ ],+ [+ 11.497416,+ "two"+ ],+ [+ 12.395833,+ "For"+ ],+ [+ 12.5,+ "Stanley"+ ],+ [+ 13.450541,+ "it's"+ ],+ [+ 13.567708,+ "the"+ ],+ [+ 13.684916,+ "other"+ ],+ [+ 13.880208,+ "way"+ ],+ [+ 14.023458,+ "around"+ ],+ [+ 14.934916,+ "He"+ ],+ [+ 15.026041,+ "is"+ ],+ [+ 15.195333,+ "owed"+ ],+ [+ 15.442708,+ "two"+ ],+ [+ 15.664083,+ "dollars"+ ],+ [+ 16.5625,+ "positive"+ ],+ [+ 17.070333,+ "two"+ ]+ ],+ "marks": {+ "story": 1.159,+ "coins": 4.245,+ "owes": 6.302,+ "neg": 11.003,+ "pos": 12.396+ },+ "cues": [+ [+ 0.104,+ "Let's try one."+ ],+ [+ 1.159,+ "Devin borrows two dollars from his friend Stanley."+ ],+ [+ 4.245,+ "Stanley hands over the money."+ ],+ [+ 6.302,+ "Now Devin owes two dollars."+ ],+ [+ 8.62,+ "Owing is a debt, so it's negative: negative two."+ ],+ [+ 12.396,+ "For Stanley, it's the other way around."+ ],+ [+ 14.935,+ "He is owed two dollars: positive two."+ ]+ ]+ },+ "q2": {+ "key": "587b8697798f84308ba638d33b8f5780ef886400",+ "dur": 3.528,+ "words": [+ [+ 0.104166,+ "Quick"+ ],+ [+ 0.273458,+ "check"+ ],+ [+ 1.197916,+ "Find"+ ],+ [+ 1.692708,+ "each"+ ],+ [+ 1.875,+ "amount"+ ],+ [+ 2.34375,+ "on"+ ],+ [+ 2.434916,+ "the"+ ],+ [+ 2.487,+ "number"+ ],+ [+ 2.747416,+ "line"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.198,+ "Find each amount on the number line."+ ]+ ]+ },+ "vertical": {+ "key": "8254e8921e5918e115244d8ecd1478d5e857c8c8",+ "dur": 32.136,+ "words": [+ [+ 0.091166,+ "A"+ ],+ [+ 0.14325,+ "number"+ ],+ [+ 0.429708,+ "line"+ ],+ [+ 0.963541,+ "doesn't"+ ],+ [+ 1.289083,+ "have"+ ],+ [+ 1.484375,+ "to"+ ],+ [+ 1.5625,+ "lie"+ ],+ [+ 1.822916,+ "flat"+ ],+ [+ 2.760416,+ "Stand"+ ],+ [+ 3.072916,+ "it"+ ],+ [+ 3.138041,+ "up"+ ],+ [+ 3.841166,+ "and"+ ],+ [+ 3.919291,+ "you"+ ],+ [+ 3.997416,+ "get"+ ],+ [+ 4.101583,+ "a"+ ],+ [+ 4.127625,+ "thermometer"+ ],+ [+ 5.234375,+ "On"+ ],+ [+ 5.338541,+ "a"+ ],+ [+ 5.429708,+ "warm"+ ],+ [+ 5.911458,+ "day"+ ],+ [+ 6.471375,+ "it"+ ],+ [+ 6.653666,+ "might"+ ],+ [+ 6.966166,+ "be"+ ],+ [+ 7.122416,+ "twenty"+ ],+ [+ 7.434916,+ "degrees"+ ],+ [+ 8.450541,+ "positive"+ ],+ [+ 8.90625,+ "twenty"+ ],+ [+ 9.765625,+ "When"+ ],+ [+ 9.84375,+ "the"+ ],+ [+ 9.908875,+ "temperature"+ ],+ [+ 10.351583,+ "falls"+ ],+ [+ 10.703125,+ "to"+ ],+ [+ 10.794291,+ "ten"+ ],+ [+ 11.041666,+ "degrees"+ ],+ [+ 11.510416,+ "below"+ ],+ [+ 11.901041,+ "zero"+ ],+ [+ 12.903666,+ "that's"+ ],+ [+ 13.151041,+ "negative"+ ],+ [+ 13.59375,+ "ten"+ ],+ [+ 14.401041,+ "Heights"+ ],+ [+ 14.596375,+ "work"+ ],+ [+ 14.765625,+ "the"+ ],+ [+ 14.856791,+ "same"+ ],+ [+ 15.182291,+ "way"+ ],+ [+ 15.989583,+ "with"+ ],+ [+ 16.145833,+ "sea"+ ],+ [+ 16.432291,+ "level"+ ],+ [+ 16.783875,+ "as"+ ],+ [+ 16.927083,+ "zero"+ ],+ [+ 17.95575,+ "A"+ ],+ [+ 18.020833,+ "gull"+ ],+ [+ 18.26825,+ "thirty"+ ],+ [+ 18.567708,+ "feet"+ ],+ [+ 19.101583,+ "above"+ ],+ [+ 19.466166,+ "the"+ ],+ [+ 19.544291,+ "water"+ ],+ [+ 20.182291,+ "is"+ ],+ [+ 20.2995,+ "at"+ ],+ [+ 20.377625,+ "positive"+ ],+ [+ 20.9245,+ "thirty"+ ],+ [+ 21.848958,+ "A"+ ],+ [+ 21.901041,+ "submarine"+ ],+ [+ 22.5,+ "thirty"+ ],+ [+ 22.851583,+ "feet"+ ],+ [+ 23.151041,+ "below"+ ],+ [+ 23.971375,+ "is"+ ],+ [+ 24.088541,+ "at"+ ],+ [+ 24.179708,+ "negative"+ ],+ [+ 24.661458,+ "thirty"+ ],+ [+ 25.612,+ "On"+ ],+ [+ 25.703125,+ "an"+ ],+ [+ 25.78125,+ "upright"+ ],+ [+ 26.171875,+ "number"+ ],+ [+ 26.40625,+ "line"+ ],+ [+ 27.252625,+ "above"+ ],+ [+ 27.617208,+ "zero"+ ],+ [+ 28.333333,+ "is"+ ],+ [+ 28.450541,+ "positive"+ ],+ [+ 29.596375,+ "and"+ ],+ [+ 29.648458,+ "below"+ ],+ [+ 30.039083,+ "zero"+ ],+ [+ 30.963541,+ "is"+ ],+ [+ 31.106791,+ "negative"+ ]+ ],+ "marks": {+ "up": 2.76,+ "warm": 5.234,+ "drop": 9.766,+ "cold": 12.904,+ "sea": 14.401,+ "gull": 17.956,+ "sub": 21.849,+ "rule": 25.612+ },+ "cues": [+ [+ 0.091,+ "A number line doesn't have to lie flat."+ ],+ [+ 2.76,+ "Stand it up, and you get a thermometer."+ ],+ [+ 5.234,+ "On a warm day it might be twenty degrees: positive twenty."+ ],+ [+ 9.766,+ "When the temperature falls to ten degrees below zero, that's negative ten."+ ],+ [+ 14.401,+ "Heights work the same way, with sea level as zero."+ ],+ [+ 17.956,+ "A gull thirty feet above the water is at positive thirty."+ ],+ [+ 21.849,+ "A submarine thirty feet below is at negative thirty."+ ],+ [+ 25.612,+ "On an upright number line, above zero is positive, and below zero is negative."+ ]+ ]+ },+ "opposites": {+ "key": "c19a66eedf70cee6bcad9c9c2972ce177821a97d",+ "dur": 25.608,+ "words": [+ [+ 0.091166,+ "Look"+ ],+ [+ 0.247416,+ "at"+ ],+ [+ 0.338541,+ "five"+ ],+ [+ 1.119791,+ "and"+ ],+ [+ 1.223958,+ "negative"+ ],+ [+ 1.536458,+ "five"+ ],+ [+ 2.526041,+ "Five"+ ],+ [+ 2.760416,+ "is"+ ],+ [+ 2.851583,+ "five"+ ],+ [+ 3.242208,+ "steps"+ ],+ [+ 3.645833,+ "to"+ ],+ [+ 3.723958,+ "the"+ ],+ [+ 3.815125,+ "right"+ ],+ [+ 4.010416,+ "of"+ ],+ [+ 4.0625,+ "zero"+ ],+ [+ 4.987,+ "Negative"+ ],+ [+ 5.3125,+ "five"+ ],+ [+ 6.119791,+ "is"+ ],+ [+ 6.237,+ "five"+ ],+ [+ 6.653666,+ "steps"+ ],+ [+ 7.083333,+ "to"+ ],+ [+ 7.1745,+ "the"+ ],+ [+ 7.265625,+ "left"+ ],+ [+ 8.151041,+ "Same"+ ],+ [+ 8.411458,+ "distance"+ ],+ [+ 8.802083,+ "from"+ ],+ [+ 8.984375,+ "zero"+ ],+ [+ 9.83075,+ "opposite"+ ],+ [+ 10.286458,+ "sides"+ ],+ [+ 11.354166,+ "Numbers"+ ],+ [+ 11.627625,+ "like"+ ],+ [+ 11.835958,+ "these"+ ],+ [+ 12.148458,+ "are"+ ],+ [+ 12.252625,+ "called"+ ],+ [+ 12.838541,+ "opposites"+ ],+ [+ 14.0625,+ "To"+ ],+ [+ 14.114583,+ "find"+ ],+ [+ 14.335958,+ "a"+ ],+ [+ 14.362,+ "number's"+ ],+ [+ 14.739583,+ "opposite"+ ],+ [+ 15.507833,+ "flip"+ ],+ [+ 15.872416,+ "it"+ ],+ [+ 15.963541,+ "across"+ ],+ [+ 16.523458,+ "zero"+ ],+ [+ 17.447916,+ "What's"+ ],+ [+ 17.578125,+ "the"+ ],+ [+ 17.695333,+ "opposite"+ ],+ [+ 18.138041,+ "of"+ ],+ [+ 18.26825,+ "eight"+ ],+ [+ 19.036458,+ "Flip"+ ],+ [+ 19.21875,+ "it"+ ],+ [+ 19.921875,+ "negative"+ ],+ [+ 20.45575,+ "eight"+ ],+ [+ 21.197916,+ "And"+ ],+ [+ 21.315125,+ "zero"+ ],+ [+ 22.109375,+ "is"+ ],+ [+ 22.239583,+ "its"+ ],+ [+ 22.526041,+ "own"+ ],+ [+ 22.721375,+ "opposite"+ ],+ [+ 23.515625,+ "because"+ ],+ [+ 23.919291,+ "flipping"+ ],+ [+ 24.505208,+ "doesn't"+ ],+ [+ 24.765625,+ "move"+ ],+ [+ 25.026041,+ "it"+ ]+ ],+ "marks": {+ "five": 2.526,+ "nfive": 4.987,+ "opp": 8.151,+ "flip": 14.062,+ "eight": 17.448,+ "zero": 21.198+ },+ "cues": [+ [+ 0.091,+ "Look at five and negative five."+ ],+ [+ 2.526,+ "Five is five steps to the right of zero."+ ],+ [+ 4.987,+ "Negative five is five steps to the left."+ ],+ [+ 8.151,+ "Same distance from zero, opposite sides."+ ],+ [+ 11.354,+ "Numbers like these are called opposites."+ ],+ [+ 14.062,+ "To find a number's opposite, flip it across zero."+ ],+ [+ 17.448,+ "What's the opposite of eight?"+ ],+ [+ 19.036,+ "Flip it: negative eight."+ ],+ [+ 21.198,+ "And zero is its own opposite, because flipping doesn't move it."+ ]+ ]+ },+ "oppopp": {+ "key": "338898086b5460d20d6067cb1dcf29be53fa5315",+ "dur": 19.032,+ "words": [+ [+ 0.104166,+ "Now"+ ],+ [+ 0.247416,+ "flip"+ ],+ [+ 0.481791,+ "twice"+ ],+ [+ 1.588541,+ "Start"+ ],+ [+ 1.848958,+ "with"+ ],+ [+ 1.979166,+ "negative"+ ],+ [+ 2.395833,+ "six"+ ],+ [+ 3.4375,+ "Its"+ ],+ [+ 3.541666,+ "opposite"+ ],+ [+ 4.023458,+ "is"+ ],+ [+ 4.153666,+ "six"+ ],+ [+ 5.325541,+ "Now"+ ],+ [+ 5.755208,+ "take"+ ],+ [+ 5.976583,+ "the"+ ],+ [+ 6.106791,+ "opposite"+ ],+ [+ 6.5625,+ "of"+ ],+ [+ 6.640625,+ "six"+ ],+ [+ 7.513041,+ "and"+ ],+ [+ 7.617208,+ "you're"+ ],+ [+ 7.721375,+ "back"+ ],+ [+ 8.059916,+ "at"+ ],+ [+ 8.138041,+ "negative"+ ],+ [+ 8.476583,+ "six"+ ],+ [+ 9.505208,+ "This"+ ],+ [+ 9.700541,+ "is"+ ],+ [+ 9.791666,+ "the"+ ],+ [+ 10.052083,+ "opposites"+ ],+ [+ 10.742208,+ "of"+ ],+ [+ 11.054708,+ "opposites"+ ],+ [+ 11.536458,+ "property"+ ],+ [+ 12.591166,+ "The"+ ],+ [+ 12.695333,+ "opposite"+ ],+ [+ 13.190125,+ "of"+ ],+ [+ 13.28125,+ "the"+ ],+ [+ 13.450541,+ "opposite"+ ],+ [+ 13.997416,+ "of"+ ],+ [+ 14.0625,+ "a"+ ],+ [+ 14.088541,+ "number"+ ],+ [+ 15.013041,+ "is"+ ],+ [+ 15.117208,+ "the"+ ],+ [+ 15.182291,+ "number"+ ],+ [+ 15.625,+ "itself"+ ],+ [+ 16.770833,+ "Two"+ ],+ [+ 16.953125,+ "flips"+ ],+ [+ 17.552083,+ "always"+ ],+ [+ 18.020833,+ "bring"+ ],+ [+ 18.190125,+ "you"+ ],+ [+ 18.307291,+ "home"+ ]+ ],+ "marks": {+ "start": 1.589,+ "first": 3.438,+ "second": 5.326,+ "rule": 9.505,+ "home": 16.771+ },+ "cues": [+ [+ 0.104,+ "Now flip twice."+ ],+ [+ 1.589,+ "Start with negative six."+ ],+ [+ 3.438,+ "Its opposite is six."+ ],+ [+ 5.326,+ "Now take the opposite of six, and you're back at negative six."+ ],+ [+ 9.505,+ "This is the opposites of opposites property."+ ],+ [+ 12.591,+ "The opposite of the opposite of a number is the number itself."+ ],+ [+ 16.771,+ "Two flips always bring you home."+ ]+ ]+ },+ "q3": {+ "key": "cdd29803dd85f071486fc984d54f63c3d40f8b89",+ "dur": 2.736,+ "words": [+ [+ 0.104166,+ "Quick"+ ],+ [+ 0.260416,+ "check"+ ],+ [+ 1.132833,+ "Flip"+ ],+ [+ 1.328125,+ "across"+ ],+ [+ 1.835958,+ "zero"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.133,+ "Flip across zero."+ ]+ ]+ },+ "wrap": {+ "key": "f56e110e92204b26183fbe0f15818e05782ed626",+ "dur": 30.096,+ "words": [+ [+ 0.104166,+ "To"+ ],+ [+ 0.15625,+ "sum"+ ],+ [+ 0.364583,+ "up"+ ],+ [+ 1.002625,+ "Positive"+ ],+ [+ 1.39325,+ "numbers"+ ],+ [+ 1.692708,+ "are"+ ],+ [+ 1.796875,+ "greater"+ ],+ [+ 2.239583,+ "than"+ ],+ [+ 2.356791,+ "zero"+ ],+ [+ 3.4245,+ "negative"+ ],+ [+ 3.763041,+ "numbers"+ ],+ [+ 4.101583,+ "are"+ ],+ [+ 4.296875,+ "less"+ ],+ [+ 4.713541,+ "than"+ ],+ [+ 4.856791,+ "zero"+ ],+ [+ 5.898458,+ "and"+ ],+ [+ 6.002625,+ "zero"+ ],+ [+ 6.757833,+ "is"+ ],+ [+ 6.914083,+ "neither"+ ],+ [+ 7.864583,+ "A"+ ],+ [+ 7.903666,+ "negative"+ ],+ [+ 8.255208,+ "number"+ ],+ [+ 8.737,+ "always"+ ],+ [+ 9.21875,+ "shows"+ ],+ [+ 9.622416,+ "its"+ ],+ [+ 9.752625,+ "minus"+ ],+ [+ 10.14325,+ "sign"+ ],+ [+ 10.9375,+ "A"+ ],+ [+ 11.002625,+ "plus"+ ],+ [+ 11.354166,+ "sign"+ ],+ [+ 12.005208,+ "is"+ ],+ [+ 12.135416,+ "optional"+ ],+ [+ 13.085958,+ "Opposite"+ ],+ [+ 13.515625,+ "quantities"+ ],+ [+ 14.544291,+ "like"+ ],+ [+ 14.895833,+ "owing"+ ],+ [+ 15.429708,+ "and"+ ],+ [+ 15.572916,+ "saving"+ ],+ [+ 16.536458,+ "or"+ ],+ [+ 16.666666,+ "below"+ ],+ [+ 17.395833,+ "and"+ ],+ [+ 17.565125,+ "above"+ ],+ [+ 18.541666,+ "get"+ ],+ [+ 18.697916,+ "opposite"+ ],+ [+ 19.153666,+ "signs"+ ],+ [+ 20.273458,+ "Opposites"+ ],+ [+ 20.690125,+ "are"+ ],+ [+ 20.794291,+ "the"+ ],+ [+ 20.898458,+ "same"+ ],+ [+ 21.289083,+ "distance"+ ],+ [+ 21.70575,+ "from"+ ],+ [+ 21.901041,+ "zero"+ ],+ [+ 22.734375,+ "on"+ ],+ [+ 22.903666,+ "opposite"+ ],+ [+ 23.359375,+ "sides"+ ],+ [+ 24.388041,+ "And"+ ],+ [+ 24.453125,+ "the"+ ],+ [+ 24.583333,+ "opposite"+ ],+ [+ 25.052083,+ "of"+ ],+ [+ 25.117208,+ "the"+ ],+ [+ 25.221375,+ "opposite"+ ],+ [+ 26.25,+ "is"+ ],+ [+ 26.39325,+ "the"+ ],+ [+ 26.471375,+ "number"+ ],+ [+ 26.901041,+ "itself"+ ],+ [+ 28.059916,+ "Now"+ ],+ [+ 28.346375,+ "try"+ ],+ [+ 28.541666,+ "the"+ ],+ [+ 28.632833,+ "chapter"+ ],+ [+ 29.023458,+ "practice"+ ]+ ],+ "marks": {+ "w1": 1.003,+ "w2": 7.865,+ "w3": 13.086,+ "w4": 20.273,+ "end": 28.06+ },+ "cues": [+ [+ 0.104,+ "To sum up."+ ],+ [+ 1.003,+ "Positive numbers are greater than zero, negative numbers are less than zero, and zero is neither."+ ],+ [+ 7.865,+ "A negative number always shows its minus sign."+ ],+ [+ 10.938,+ "A plus sign is optional."+ ],+ [+ 13.086,+ "Opposite quantities, like owing and saving, or below and above, get opposite signs."+ ],+ [+ 20.273,+ "Opposites are the same distance from zero, on opposite sides."+ ],+ [+ 24.388,+ "And the opposite of the opposite is the number itself."+ ],+ [+ 28.06,+ "Now try the chapter practice."+ ]+ ]+ },+ "final1": {+ "key": "1dfafa1306acc9510e15ddd630d74601b70be025",+ "dur": 3.864,+ "words": [+ [+ 0.104166,+ "Chapter"+ ],+ [+ 0.390625,+ "practice"+ ],+ [+ 1.497416,+ "Write"+ ],+ [+ 1.692708,+ "the"+ ],+ [+ 1.796875,+ "integer"+ ],+ [+ 2.317708,+ "for"+ ],+ [+ 2.65625,+ "each"+ ],+ [+ 2.838541,+ "quantity"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Chapter practice."+ ],+ [+ 1.497,+ "Write the integer for each quantity."+ ]+ ]+ },+ "final2": {+ "key": "c6c0629e0653c2b5cd9598045cc4eaf52dd14477",+ "dur": 2.016,+ "words": [+ [+ 0.091166,+ "Now"+ ],+ [+ 0.494791,+ "find"+ ],+ [+ 0.755208,+ "the"+ ],+ [+ 0.820333,+ "opposites"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.091,+ "Now find the opposites."+ ]+ ]+ },+ "final3": {+ "key": "9bca771bba9b960b34441b0ed5e6db0ce53f9444",+ "dur": 2.616,+ "words": [+ [+ 0.104166,+ "Last"+ ],+ [+ 0.403666,+ "one"+ ],+ [+ 1.158875,+ "True"+ ],+ [+ 1.5495,+ "or"+ ],+ [+ 1.666666,+ "false"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Last one."+ ],+ [+ 1.159,+ "True or false?"+ ]+ ]+ },+ "finish": {+ "key": "5906c1c246ffc4f145002aad9b50775185b42b26",+ "dur": 2.832,+ "words": [+ [+ 0.104166,+ "Great"+ ],+ [+ 0.351583,+ "job"+ ],+ [+ 1.158875,+ "That's"+ ],+ [+ 1.328125,+ "the"+ ],+ [+ 1.432291,+ "end"+ ],+ [+ 1.536458,+ "of"+ ],+ [+ 1.614583,+ "chapter"+ ],+ [+ 2.044291,+ "two"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Great job."+ ],+ [+ 1.159,+ "That's the end of chapter two."+ ]+ ]+ }+}\ No newline at end of filediff --git a/content/math-notebook/ch03/narration.en.json b/content/math-notebook/ch03/narration.en.jsonnew file mode 100644index 0000000..1cb5f59--- /dev/null+++ b/content/math-notebook/ch03/narration.en.json@@ -0,0 +1,24 @@+{+ "voice": "en-US-AndrewMultilingualNeural",+ "rate": "-4%",+ "beats": {+ "intro": "Chapter three. Absolute value. [[sub]]Forget which way. How far is a number from zero?",+ "distance": "Here's our number line again. [[far]]How far is negative four from zero? [[hops]]Let's count the steps: [[h1]]one, [[h2]]two, [[h3]]three, [[h4]]four. [[steps]]Four steps. Walking left or walking right, a distance is just a length, so the distance is four. [[def]]That distance has a special name: absolute value. The absolute value of a number is its distance from zero. [[bars]]To write it, put two straight bars around the number. [[read]]You read this as: the absolute value of negative four is four.",+ "itself": "What about a positive number, like seven? [[seven]]Seven is seven steps from zero, to the right. [[same]]So the absolute value of seven is seven. For a positive number, the absolute value is just the number itself. [[zero]]And zero? Zero is zero steps away from itself, so the absolute value of zero is zero. [[never]]A distance can be zero, but it can never be negative. So an absolute value is never negative.",+ "q1": "Quick check. Think distance, not direction.",+ "pair": "Now look at five and negative five. [[five]]Five is five steps to the right of zero. [[nfive]]Negative five is five steps to the left. [[lift]]Lift both distances off the line and lay them side by side. [[same]]Exactly the same length. Opposites always have the same absolute value: the absolute value of negative five and the absolute value of five are both five. [[split]]So a number like negative five tells you two things. [[sign]]Its sign tells you which side of zero it's on. [[size]]Its absolute value tells you how far away it is.",+ "world": "Absolute value shows up whenever you care about how much, and not which way. [[diver]]A diver swims thirty feet below sea level. Her position is negative thirty. [[depth]]But her depth, how far down she is, is thirty feet: the absolute value of negative thirty. [[bal]]Or say Maya's bank balance is negative forty-two dollars and seventy-five cents. [[owe]]That means she owes forty-two dollars and seventy-five cents. The size of her debt is the absolute value of her balance. [[how]]Positions and balances carry a sign. Depths, distances and amounts owed are absolute values.",+ "q2": "Quick check. How much, without the sign?",+ "inside": "Absolute value bars are also grouping symbols, like parentheses. [[first]]That means you finish the work inside the bars first. [[five]]Here it's five minus three. Start at five, [[back]]and step three back. You land on two. [[inside]]So the inside becomes two. [[abs]]Then take the absolute value. Two is two steps from zero, so the answer is two. [[rule]]Inside first, then the absolute value.",+ "outside": "Sometimes there's a sign outside the bars. [[six]]This one says: negative, the absolute value of six. Think inside, then outside. [[inside]]Inside: the absolute value of six is six. [[then]]Outside: a minus sign in front means the opposite. [[flip]]And the opposite of six is negative six. [[seven]]Now try: negative, the absolute value of negative seven. [[inside2]]Inside: the absolute value of negative seven is seven. [[wrong]]Careful here. The two minus signs don't cancel each other, so the answer is not seven. [[flip2]]The minus outside flips seven over to negative seven. [[rule]]Inside first, then outside.",+ "q3": "Quick check. Inside first, then outside.",+ "times": "One more thing. [[front]]A number right in front of the bars means multiply, just like a number in front of parentheses. [[inside]]Inside first: the absolute value of negative four is four. [[times]]Then multiply: two times four. [[tapes]]Two distances of four, laid end to end, [[eight]]make eight.",+ "ways": "By the way, multiplication can be written in several ways, not only with a times sign. [[ways]]You can use a dot, two sets of parentheses, or a number touching parentheses. [[same]]All of these mean two times four, which is eight. [[var]]With letters, you just write them side by side. [[ab]]a b means a times b, [[three]]and three x means three times x. [[word]]A letter like x is called a variable. It stands for a number we don't know yet.",+ "wrap": "Let's wrap up. [[w1]]Absolute value is distance from zero. [[w2]]It's never negative, and opposites share the same absolute value. [[w3]]The bars group: work inside first, then apply any sign outside. [[w4]]And a number in front of the bars means multiply. [[end]]Now try the chapter practice.",+ "final1": "Chapter practice. Find each absolute value.",+ "final2": "Now some with work inside or outside the bars.",+ "final3": "Absolute value in the real world.",+ "final4": "Last set. True or false?",+ "finish": "That's chapter three. Nice work."+ }+}diff --git a/content/math-notebook/ch03/narration.en.timings.json b/content/math-notebook/ch03/narration.en.timings.jsonnew file mode 100644index 0000000..ff4fa53--- /dev/null+++ b/content/math-notebook/ch03/narration.en.timings.json@@ -0,0 +1,3484 @@+{+ "intro": {+ "key": "ae7ce5ed51b09bb0e9de0f7991b24837e1e7b582",+ "dur": 6.192,+ "words": [+ [+ 0.104166,+ "Chapter"+ ],+ [+ 0.442708,+ "three"+ ],+ [+ 1.289083,+ "Absolute"+ ],+ [+ 1.809916,+ "value"+ ],+ [+ 2.760416,+ "Forget"+ ],+ [+ 3.177083,+ "which"+ ],+ [+ 3.398458,+ "way"+ ],+ [+ 4.179708,+ "How"+ ],+ [+ 4.362,+ "far"+ ],+ [+ 4.6745,+ "is"+ ],+ [+ 4.765625,+ "a"+ ],+ [+ 4.791666,+ "number"+ ],+ [+ 5.130208,+ "from"+ ],+ [+ 5.2995,+ "zero"+ ]+ ],+ "marks": {+ "sub": 2.76+ },+ "cues": [+ [+ 0.104,+ "Chapter three."+ ],+ [+ 1.289,+ "Absolute value."+ ],+ [+ 2.76,+ "Forget which way."+ ],+ [+ 4.18,+ "How far is a number from zero?"+ ]+ ]+ },+ "distance": {+ "key": "f5977359e9257cdd1cd215ee1c536fc8f8965d7d",+ "dur": 30.888,+ "words": [+ [+ 0.117208,+ "Here's"+ ],+ [+ 0.338541,+ "our"+ ],+ [+ 0.416666,+ "number"+ ],+ [+ 0.677083,+ "line"+ ],+ [+ 0.9245,+ "again"+ ],+ [+ 1.679708,+ "How"+ ],+ [+ 1.835958,+ "far"+ ],+ [+ 2.096375,+ "is"+ ],+ [+ 2.1745,+ "negative"+ ],+ [+ 2.708333,+ "four"+ ],+ [+ 3.372416,+ "from"+ ],+ [+ 3.567708,+ "zero"+ ],+ [+ 4.492208,+ "Let's"+ ],+ [+ 4.622416,+ "count"+ ],+ [+ 4.84375,+ "the"+ ],+ [+ 4.908875,+ "steps"+ ],+ [+ 5.742208,+ "one"+ ],+ [+ 6.054708,+ "two"+ ],+ [+ 6.71875,+ "three"+ ],+ [+ 7.1745,+ "four"+ ],+ [+ 8.112,+ "Four"+ ],+ [+ 8.229166,+ "steps"+ ],+ [+ 9.179708,+ "Walking"+ ],+ [+ 9.583333,+ "left"+ ],+ [+ 10.15625,+ "or"+ ],+ [+ 10.2995,+ "walking"+ ],+ [+ 10.76825,+ "right"+ ],+ [+ 11.458333,+ "a"+ ],+ [+ 11.5625,+ "distance"+ ],+ [+ 12.096375,+ "is"+ ],+ [+ 12.226583,+ "just"+ ],+ [+ 12.447916,+ "a"+ ],+ [+ 12.5,+ "length"+ ],+ [+ 13.307291,+ "so"+ ],+ [+ 13.476583,+ "the"+ ],+ [+ 13.58075,+ "distance"+ ],+ [+ 14.010416,+ "is"+ ],+ [+ 14.127625,+ "four"+ ],+ [+ 15.039083,+ "That"+ ],+ [+ 15.247416,+ "distance"+ ],+ [+ 15.651041,+ "has"+ ],+ [+ 15.807291,+ "a"+ ],+ [+ 15.872416,+ "special"+ ],+ [+ 16.367208,+ "name"+ ],+ [+ 17.356791,+ "absolute"+ ],+ [+ 17.851583,+ "value"+ ],+ [+ 18.75,+ "The"+ ],+ [+ 18.854166,+ "absolute"+ ],+ [+ 19.362,+ "value"+ ],+ [+ 19.739583,+ "of"+ ],+ [+ 19.804708,+ "a"+ ],+ [+ 19.83075,+ "number"+ ],+ [+ 20.559916,+ "is"+ ],+ [+ 20.664083,+ "its"+ ],+ [+ 20.820333,+ "distance"+ ],+ [+ 21.302083,+ "from"+ ],+ [+ 21.458333,+ "zero"+ ],+ [+ 22.421875,+ "To"+ ],+ [+ 22.5,+ "write"+ ],+ [+ 22.721375,+ "it"+ ],+ [+ 23.177083,+ "put"+ ],+ [+ 23.398458,+ "two"+ ],+ [+ 23.671875,+ "straight"+ ],+ [+ 24.0625,+ "bars"+ ],+ [+ 24.362,+ "around"+ ],+ [+ 24.648458,+ "the"+ ],+ [+ 24.6875,+ "number"+ ],+ [+ 25.546875,+ "You"+ ],+ [+ 25.677083,+ "read"+ ],+ [+ 25.9375,+ "this"+ ],+ [+ 26.497416,+ "as"+ ],+ [+ 27.434916,+ "the"+ ],+ [+ 27.617208,+ "absolute"+ ],+ [+ 28.125,+ "value"+ ],+ [+ 28.489583,+ "of"+ ],+ [+ 28.567708,+ "negative"+ ],+ [+ 29.0625,+ "four"+ ],+ [+ 29.84375,+ "is"+ ],+ [+ 29.973958,+ "four"+ ]+ ],+ "marks": {+ "far": 1.68,+ "hops": 4.492,+ "h1": 5.742,+ "h2": 6.055,+ "h3": 6.719,+ "h4": 7.175,+ "steps": 8.112,+ "def": 15.039,+ "bars": 22.422,+ "read": 25.547+ },+ "cues": [+ [+ 0.117,+ "Here's our number line again."+ ],+ [+ 1.68,+ "How far is negative four from zero?"+ ],+ [+ 4.492,+ "Let's count the steps: one, two, three, four."+ ],+ [+ 8.112,+ "Four steps."+ ],+ [+ 9.18,+ "Walking left or walking right, a distance is just a length, so the distance is four."+ ],+ [+ 15.039,+ "That distance has a special name: absolute value."+ ],+ [+ 18.75,+ "The absolute value of a number is its distance from zero."+ ],+ [+ 22.422,+ "To write it, put two straight bars around the number."+ ],+ [+ 25.547,+ "You read this as: the absolute value of negative four is four."+ ]+ ]+ },+ "itself": {+ "key": "3061f36ebbcb41e34adb6591022202a81882bd55",+ "dur": 27.6,+ "words": [+ [+ 0.104166,+ "What"+ ],+ [+ 0.169291,+ "about"+ ],+ [+ 0.351583,+ "a"+ ],+ [+ 0.403666,+ "positive"+ ],+ [+ 0.9245,+ "number"+ ],+ [+ 1.276041,+ "like"+ ],+ [+ 1.40625,+ "seven"+ ],+ [+ 2.304708,+ "Seven"+ ],+ [+ 2.8125,+ "is"+ ],+ [+ 2.981791,+ "seven"+ ],+ [+ 3.463541,+ "steps"+ ],+ [+ 3.880208,+ "from"+ ],+ [+ 4.075541,+ "zero"+ ],+ [+ 4.882833,+ "to"+ ],+ [+ 4.973958,+ "the"+ ],+ [+ 5.065125,+ "right"+ ],+ [+ 5.9375,+ "So"+ ],+ [+ 6.028666,+ "the"+ ],+ [+ 6.145833,+ "absolute"+ ],+ [+ 6.640625,+ "value"+ ],+ [+ 6.979166,+ "of"+ ],+ [+ 7.044291,+ "seven"+ ],+ [+ 7.786458,+ "is"+ ],+ [+ 7.903666,+ "seven"+ ],+ [+ 8.945333,+ "For"+ ],+ [+ 9.0495,+ "a"+ ],+ [+ 9.101583,+ "positive"+ ],+ [+ 9.583333,+ "number"+ ],+ [+ 10.403666,+ "the"+ ],+ [+ 10.533875,+ "absolute"+ ],+ [+ 11.015625,+ "value"+ ],+ [+ 11.575541,+ "is"+ ],+ [+ 11.796875,+ "just"+ ],+ [+ 12.070333,+ "the"+ ],+ [+ 12.135416,+ "number"+ ],+ [+ 12.447916,+ "itself"+ ],+ [+ 13.567708,+ "And"+ ],+ [+ 13.684916,+ "zero"+ ],+ [+ 14.6745,+ "Zero"+ ],+ [+ 15.273458,+ "is"+ ],+ [+ 15.690125,+ "zero"+ ],+ [+ 16.132833,+ "steps"+ ],+ [+ 16.679708,+ "away"+ ],+ [+ 17.057291,+ "from"+ ],+ [+ 17.239583,+ "itself"+ ],+ [+ 18.320333,+ "so"+ ],+ [+ 18.450541,+ "the"+ ],+ [+ 18.58075,+ "absolute"+ ],+ [+ 19.088541,+ "value"+ ],+ [+ 19.505208,+ "of"+ ],+ [+ 19.596375,+ "zero"+ ],+ [+ 20.377625,+ "is"+ ],+ [+ 20.572916,+ "zero"+ ],+ [+ 21.5625,+ "A"+ ],+ [+ 21.640625,+ "distance"+ ],+ [+ 22.01825,+ "can"+ ],+ [+ 22.135416,+ "be"+ ],+ [+ 22.252625,+ "zero"+ ],+ [+ 23.177083,+ "but"+ ],+ [+ 23.307291,+ "it"+ ],+ [+ 23.359375,+ "can"+ ],+ [+ 23.476583,+ "never"+ ],+ [+ 23.697916,+ "be"+ ],+ [+ 23.802083,+ "negative"+ ],+ [+ 24.869791,+ "So"+ ],+ [+ 25.013041,+ "an"+ ],+ [+ 25.091166,+ "absolute"+ ],+ [+ 25.559916,+ "value"+ ],+ [+ 26.132833,+ "is"+ ],+ [+ 26.263041,+ "never"+ ],+ [+ 26.692708,+ "negative"+ ]+ ],+ "marks": {+ "seven": 2.305,+ "same": 5.938,+ "zero": 13.568,+ "never": 21.562+ },+ "cues": [+ [+ 0.104,+ "What about a positive number, like seven?"+ ],+ [+ 2.305,+ "Seven is seven steps from zero, to the right."+ ],+ [+ 5.938,+ "So the absolute value of seven is seven."+ ],+ [+ 8.945,+ "For a positive number, the absolute value is just the number itself."+ ],+ [+ 13.568,+ "And zero?"+ ],+ [+ 14.675,+ "Zero is zero steps away from itself, so the absolute value of zero is zero."+ ],+ [+ 21.562,+ "A distance can be zero, but it can never be negative."+ ],+ [+ 24.87,+ "So an absolute value is never negative."+ ]+ ]+ },+ "q1": {+ "key": "aa5bc0d389e825d8803e308083c742f29c96a33f",+ "dur": 3.384,+ "words": [+ [+ 0.104166,+ "Quick"+ ],+ [+ 0.260416,+ "check"+ ],+ [+ 1.158875,+ "Think"+ ],+ [+ 1.341166,+ "distance"+ ],+ [+ 2.1875,+ "not"+ ],+ [+ 2.395833,+ "direction"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.159,+ "Think distance, not direction."+ ]+ ]+ },+ "pair": {+ "key": "573441df3860edc942bbfffe272614e25cc18ffc",+ "dur": 33.312,+ "words": [+ [+ 0.104166,+ "Now"+ ],+ [+ 0.273458,+ "look"+ ],+ [+ 0.416666,+ "at"+ ],+ [+ 0.507833,+ "five"+ ],+ [+ 1.289083,+ "and"+ ],+ [+ 1.367208,+ "negative"+ ],+ [+ 1.70575,+ "five"+ ],+ [+ 2.669291,+ "Five"+ ],+ [+ 2.903666,+ "is"+ ],+ [+ 3.020833,+ "five"+ ],+ [+ 3.4245,+ "steps"+ ],+ [+ 3.867208,+ "to"+ ],+ [+ 3.958333,+ "the"+ ],+ [+ 4.0625,+ "right"+ ],+ [+ 4.283875,+ "of"+ ],+ [+ 4.322916,+ "zero"+ ],+ [+ 5.247416,+ "Negative"+ ],+ [+ 5.572916,+ "five"+ ],+ [+ 6.458333,+ "is"+ ],+ [+ 6.601583,+ "five"+ ],+ [+ 7.057291,+ "steps"+ ],+ [+ 7.473958,+ "to"+ ],+ [+ 7.552083,+ "the"+ ],+ [+ 7.65625,+ "left"+ ],+ [+ 8.515625,+ "Lift"+ ],+ [+ 8.89325,+ "both"+ ],+ [+ 9.179708,+ "distances"+ ],+ [+ 9.791666,+ "off"+ ],+ [+ 10.026041,+ "the"+ ],+ [+ 10.117208,+ "line"+ ],+ [+ 10.78125,+ "and"+ ],+ [+ 10.911458,+ "lay"+ ],+ [+ 11.067708,+ "them"+ ],+ [+ 11.197916,+ "side"+ ],+ [+ 11.484375,+ "by"+ ],+ [+ 11.640625,+ "side"+ ],+ [+ 12.539083,+ "Exactly"+ ],+ [+ 13.085958,+ "the"+ ],+ [+ 13.190125,+ "same"+ ],+ [+ 13.541666,+ "length"+ ],+ [+ 14.388041,+ "Opposites"+ ],+ [+ 14.947916,+ "always"+ ],+ [+ 15.390625,+ "have"+ ],+ [+ 15.572916,+ "the"+ ],+ [+ 15.651041,+ "same"+ ],+ [+ 16.210958,+ "absolute"+ ],+ [+ 16.757833,+ "value"+ ],+ [+ 17.604166,+ "the"+ ],+ [+ 17.708333,+ "absolute"+ ],+ [+ 18.216166,+ "value"+ ],+ [+ 18.606791,+ "of"+ ],+ [+ 18.671875,+ "negative"+ ],+ [+ 19.166666,+ "five"+ ],+ [+ 20.130208,+ "and"+ ],+ [+ 20.182291,+ "the"+ ],+ [+ 20.403666,+ "absolute"+ ],+ [+ 20.885416,+ "value"+ ],+ [+ 21.237,+ "of"+ ],+ [+ 21.302083,+ "five"+ ],+ [+ 22.1745,+ "are"+ ],+ [+ 22.33075,+ "both"+ ],+ [+ 22.617208,+ "five"+ ],+ [+ 23.632833,+ "So"+ ],+ [+ 23.763041,+ "a"+ ],+ [+ 23.789083,+ "number"+ ],+ [+ 24.036458,+ "like"+ ],+ [+ 24.270833,+ "negative"+ ],+ [+ 24.778666,+ "five"+ ],+ [+ 25.533875,+ "tells"+ ],+ [+ 25.846375,+ "you"+ ],+ [+ 25.9375,+ "two"+ ],+ [+ 26.158875,+ "things"+ ],+ [+ 27.1875,+ "Its"+ ],+ [+ 27.304708,+ "sign"+ ],+ [+ 27.578125,+ "tells"+ ],+ [+ 27.7995,+ "you"+ ],+ [+ 27.903666,+ "which"+ ],+ [+ 28.098958,+ "side"+ ],+ [+ 28.4245,+ "of"+ ],+ [+ 28.515625,+ "zero"+ ],+ [+ 28.932291,+ "it's"+ ],+ [+ 29.0625,+ "on"+ ],+ [+ 29.765625,+ "Its"+ ],+ [+ 29.960958,+ "absolute"+ ],+ [+ 30.494791,+ "value"+ ],+ [+ 31.119791,+ "tells"+ ],+ [+ 31.39325,+ "you"+ ],+ [+ 31.523458,+ "how"+ ],+ [+ 31.848958,+ "far"+ ],+ [+ 32.213541,+ "away"+ ],+ [+ 32.487,+ "it"+ ],+ [+ 32.565125,+ "is"+ ]+ ],+ "marks": {+ "five": 2.669,+ "nfive": 5.247,+ "lift": 8.516,+ "same": 12.539,+ "split": 23.633,+ "sign": 27.188,+ "size": 29.766+ },+ "cues": [+ [+ 0.104,+ "Now look at five and negative five."+ ],+ [+ 2.669,+ "Five is five steps to the right of zero."+ ],+ [+ 5.247,+ "Negative five is five steps to the left."+ ],+ [+ 8.516,+ "Lift both distances off the line and lay them side by side."+ ],+ [+ 12.539,+ "Exactly the same length."+ ],+ [+ 14.388,+ "Opposites always have the same absolute value: the absolute value of negative five and the absolute value of five are both five."+ ],+ [+ 23.633,+ "So a number like negative five tells you two things."+ ],+ [+ 27.188,+ "Its sign tells you which side of zero it's on."+ ],+ [+ 29.766,+ "Its absolute value tells you how far away it is."+ ]+ ]+ },+ "world": {+ "key": "c13fec930d68252255bcf932be3ec3c311172478",+ "dur": 39.336,+ "words": [+ [+ 0.104166,+ "Absolute"+ ],+ [+ 0.559916,+ "value"+ ],+ [+ 0.9245,+ "shows"+ ],+ [+ 1.302083,+ "up"+ ],+ [+ 1.536458,+ "whenever"+ ],+ [+ 1.914083,+ "you"+ ],+ [+ 2.044291,+ "care"+ ],+ [+ 2.33075,+ "about"+ ],+ [+ 2.578125,+ "how"+ ],+ [+ 2.747416,+ "much"+ ],+ [+ 3.541666,+ "and"+ ],+ [+ 3.697916,+ "not"+ ],+ [+ 3.958333,+ "which"+ ],+ [+ 4.166666,+ "way"+ ],+ [+ 4.934916,+ "A"+ ],+ [+ 4.987,+ "diver"+ ],+ [+ 5.390625,+ "swims"+ ],+ [+ 6.054708,+ "thirty"+ ],+ [+ 6.432291,+ "feet"+ ],+ [+ 6.875,+ "below"+ ],+ [+ 7.695333,+ "sea"+ ],+ [+ 7.916666,+ "level"+ ],+ [+ 8.789083,+ "Her"+ ],+ [+ 8.89325,+ "position"+ ],+ [+ 9.544291,+ "is"+ ],+ [+ 9.700541,+ "negative"+ ],+ [+ 10.2995,+ "thirty"+ ],+ [+ 11.315125,+ "But"+ ],+ [+ 11.40625,+ "her"+ ],+ [+ 11.588541,+ "depth"+ ],+ [+ 12.252625,+ "how"+ ],+ [+ 12.5,+ "far"+ ],+ [+ 12.8125,+ "down"+ ],+ [+ 13.098958,+ "she"+ ],+ [+ 13.372416,+ "is"+ ],+ [+ 13.763041,+ "is"+ ],+ [+ 13.997416,+ "thirty"+ ],+ [+ 14.348958,+ "feet"+ ],+ [+ 15.2995,+ "the"+ ],+ [+ 15.429708,+ "absolute"+ ],+ [+ 15.911458,+ "value"+ ],+ [+ 16.419291,+ "of"+ ],+ [+ 16.497416,+ "negative"+ ],+ [+ 17.03125,+ "thirty"+ ],+ [+ 17.994791,+ "Or"+ ],+ [+ 18.125,+ "say"+ ],+ [+ 18.359375,+ "Maya's"+ ],+ [+ 18.815125,+ "bank"+ ],+ [+ 19.127625,+ "balance"+ ],+ [+ 19.804708,+ "is"+ ],+ [+ 19.947916,+ "negative"+ ],+ [+ 20.546875,+ "forty-two"+ ],+ [+ 21.25,+ "dollars"+ ],+ [+ 22.005208,+ "and"+ ],+ [+ 22.135416,+ "seventy-five"+ ],+ [+ 22.864583,+ "cents"+ ],+ [+ 23.867208,+ "That"+ ],+ [+ 23.984375,+ "means"+ ],+ [+ 24.231791,+ "she"+ ],+ [+ 24.440125,+ "owes"+ ],+ [+ 24.713541,+ "forty-two"+ ],+ [+ 25.403666,+ "dollars"+ ],+ [+ 26.171875,+ "and"+ ],+ [+ 26.315125,+ "seventy-five"+ ],+ [+ 27.109375,+ "cents"+ ],+ [+ 28.151041,+ "The"+ ],+ [+ 28.216166,+ "size"+ ],+ [+ 28.554708,+ "of"+ ],+ [+ 28.619791,+ "her"+ ],+ [+ 28.723958,+ "debt"+ ],+ [+ 29.453125,+ "is"+ ],+ [+ 29.557291,+ "the"+ ],+ [+ 29.817708,+ "absolute"+ ],+ [+ 30.416666,+ "value"+ ],+ [+ 30.872416,+ "of"+ ],+ [+ 30.963541,+ "her"+ ],+ [+ 31.067708,+ "balance"+ ],+ [+ 32.109375,+ "Positions"+ ],+ [+ 32.851583,+ "and"+ ],+ [+ 32.96875,+ "balances"+ ],+ [+ 33.658875,+ "carry"+ ],+ [+ 33.971375,+ "a"+ ],+ [+ 34.023458,+ "sign"+ ],+ [+ 34.947916,+ "Depths"+ ],+ [+ 35.664083,+ "distances"+ ],+ [+ 36.276041,+ "and"+ ],+ [+ 36.341166,+ "amounts"+ ],+ [+ 36.783875,+ "owed"+ ],+ [+ 37.526041,+ "are"+ ],+ [+ 37.760416,+ "absolute"+ ],+ [+ 38.28125,+ "values"+ ]+ ],+ "marks": {+ "diver": 4.935,+ "depth": 11.315,+ "bal": 17.995,+ "owe": 23.867,+ "how": 32.109+ },+ "cues": [+ [+ 0.104,+ "Absolute value shows up whenever you care about how much, and not which way."+ ],+ [+ 4.935,+ "A diver swims thirty feet below sea level."+ ],+ [+ 8.789,+ "Her position is negative thirty."+ ],+ [+ 11.315,+ "But her depth, how far down she is, is thirty feet: the absolute value of negative thirty."+ ],+ [+ 17.995,+ "Or say Maya's bank balance is negative forty-two dollars and seventy-five cents."+ ],+ [+ 23.867,+ "That means she owes forty-two dollars and seventy-five cents."+ ],+ [+ 28.151,+ "The size of her debt is the absolute value of her balance."+ ],+ [+ 32.109,+ "Positions and balances carry a sign."+ ],+ [+ 34.948,+ "Depths, distances and amounts owed are absolute values."+ ]+ ]+ },+ "q2": {+ "key": "5019e8876674b269c85090e47712f5801b591f56",+ "dur": 2.952,+ "words": [+ [+ 0.091166,+ "Quick"+ ],+ [+ 0.260416,+ "check"+ ],+ [+ 1.158875,+ "How"+ ],+ [+ 1.289083,+ "much"+ ],+ [+ 1.640625,+ "without"+ ],+ [+ 2.044291,+ "the"+ ],+ [+ 2.122416,+ "sign"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.091,+ "Quick check."+ ],+ [+ 1.159,+ "How much, without the sign?"+ ]+ ]+ },+ "inside": {+ "key": "6ba811fadd468982a96ee176dfdb9809a6ae67e5",+ "dur": 24.384,+ "words": [+ [+ 0.104166,+ "Absolute"+ ],+ [+ 0.507833,+ "value"+ ],+ [+ 0.820333,+ "bars"+ ],+ [+ 1.210958,+ "are"+ ],+ [+ 1.445333,+ "also"+ ],+ [+ 1.992208,+ "grouping"+ ],+ [+ 2.539083,+ "symbols"+ ],+ [+ 3.359375,+ "like"+ ],+ [+ 3.489583,+ "parentheses"+ ],+ [+ 4.778666,+ "That"+ ],+ [+ 4.856791,+ "means"+ ],+ [+ 5.091166,+ "you"+ ],+ [+ 5.221375,+ "finish"+ ],+ [+ 5.572916,+ "the"+ ],+ [+ 5.716166,+ "work"+ ],+ [+ 6.002625,+ "inside"+ ],+ [+ 6.536458,+ "the"+ ],+ [+ 6.601583,+ "bars"+ ],+ [+ 6.953125,+ "first"+ ],+ [+ 7.96875,+ "Here"+ ],+ [+ 8.072916,+ "it's"+ ],+ [+ 8.203125,+ "five"+ ],+ [+ 8.632833,+ "minus"+ ],+ [+ 8.984375,+ "three"+ ],+ [+ 9.804708,+ "Start"+ ],+ [+ 10.013041,+ "at"+ ],+ [+ 10.091166,+ "five"+ ],+ [+ 10.846375,+ "and"+ ],+ [+ 10.963541,+ "step"+ ],+ [+ 11.223958,+ "three"+ ],+ [+ 11.575541,+ "back"+ ],+ [+ 12.460958,+ "You"+ ],+ [+ 12.552083,+ "land"+ ],+ [+ 12.7995,+ "on"+ ],+ [+ 12.95575,+ "two"+ ],+ [+ 13.737,+ "So"+ ],+ [+ 13.867208,+ "the"+ ],+ [+ 13.945333,+ "inside"+ ],+ [+ 14.583333,+ "becomes"+ ],+ [+ 14.987,+ "two"+ ],+ [+ 15.78125,+ "Then"+ ],+ [+ 15.989583,+ "take"+ ],+ [+ 16.210958,+ "the"+ ],+ [+ 16.445333,+ "absolute"+ ],+ [+ 16.966166,+ "value"+ ],+ [+ 17.825541,+ "Two"+ ],+ [+ 18.098958,+ "is"+ ],+ [+ 18.216166,+ "two"+ ],+ [+ 18.489583,+ "steps"+ ],+ [+ 18.841166,+ "from"+ ],+ [+ 19.036458,+ "zero"+ ],+ [+ 19.960958,+ "so"+ ],+ [+ 20.078125,+ "the"+ ],+ [+ 20.169291,+ "answer"+ ],+ [+ 20.533875,+ "is"+ ],+ [+ 20.690125,+ "two"+ ],+ [+ 21.484375,+ "Inside"+ ],+ [+ 21.901041,+ "first"+ ],+ [+ 22.8125,+ "then"+ ],+ [+ 22.929708,+ "the"+ ],+ [+ 23.020833,+ "absolute"+ ],+ [+ 23.541666,+ "value"+ ]+ ],+ "marks": {+ "first": 4.779,+ "five": 7.969,+ "back": 10.846,+ "inside": 13.737,+ "abs": 15.781,+ "rule": 21.484+ },+ "cues": [+ [+ 0.104,+ "Absolute value bars are also grouping symbols, like parentheses."+ ],+ [+ 4.779,+ "That means you finish the work inside the bars first."+ ],+ [+ 7.969,+ "Here it's five minus three."+ ],+ [+ 9.805,+ "Start at five, and step three back."+ ],+ [+ 12.461,+ "You land on two."+ ],+ [+ 13.737,+ "So the inside becomes two."+ ],+ [+ 15.781,+ "Then take the absolute value."+ ],+ [+ 17.826,+ "Two is two steps from zero, so the answer is two."+ ],+ [+ 21.484,+ "Inside first, then the absolute value."+ ]+ ]+ },+ "outside": {+ "key": "b04a9109adb609dcf5dd859f4990fcb7f4bb1a8f",+ "dur": 40.8,+ "words": [+ [+ 0.104166,+ "Sometimes"+ ],+ [+ 0.572916,+ "there's"+ ],+ [+ 0.729166,+ "a"+ ],+ [+ 0.76825,+ "sign"+ ],+ [+ 1.145833,+ "outside"+ ],+ [+ 1.640625,+ "the"+ ],+ [+ 1.692708,+ "bars"+ ],+ [+ 2.708333,+ "This"+ ],+ [+ 2.838541,+ "one"+ ],+ [+ 3.020833,+ "says"+ ],+ [+ 3.919291,+ "negative"+ ],+ [+ 4.817708,+ "the"+ ],+ [+ 5.078125,+ "absolute"+ ],+ [+ 5.625,+ "value"+ ],+ [+ 5.989583,+ "of"+ ],+ [+ 6.067708,+ "six"+ ],+ [+ 7.213541,+ "Think"+ ],+ [+ 7.356791,+ "inside"+ ],+ [+ 7.95575,+ "then"+ ],+ [+ 8.085958,+ "outside"+ ],+ [+ 9.114583,+ "Inside"+ ],+ [+ 10.104166,+ "the"+ ],+ [+ 10.234375,+ "absolute"+ ],+ [+ 10.677083,+ "value"+ ],+ [+ 11.002625,+ "of"+ ],+ [+ 11.08075,+ "six"+ ],+ [+ 11.731791,+ "is"+ ],+ [+ 11.862,+ "six"+ ],+ [+ 12.916666,+ "Outside"+ ],+ [+ 13.984375,+ "a"+ ],+ [+ 14.023458,+ "minus"+ ],+ [+ 14.414083,+ "sign"+ ],+ [+ 14.661458,+ "in"+ ],+ [+ 14.752625,+ "front"+ ],+ [+ 15.377625,+ "means"+ ],+ [+ 15.598958,+ "the"+ ],+ [+ 15.716166,+ "opposite"+ ],+ [+ 16.731791,+ "And"+ ],+ [+ 16.796875,+ "the"+ ],+ [+ 16.888041,+ "opposite"+ ],+ [+ 17.317708,+ "of"+ ],+ [+ 17.408875,+ "six"+ ],+ [+ 18.203125,+ "is"+ ],+ [+ 18.320333,+ "negative"+ ],+ [+ 18.75,+ "six"+ ],+ [+ 19.778666,+ "Now"+ ],+ [+ 19.947916,+ "try"+ ],+ [+ 20.9245,+ "negative"+ ],+ [+ 21.744791,+ "the"+ ],+ [+ 21.953125,+ "absolute"+ ],+ [+ 22.539083,+ "value"+ ],+ [+ 23.033875,+ "of"+ ],+ [+ 23.151041,+ "negative"+ ],+ [+ 23.645833,+ "seven"+ ],+ [+ 24.505208,+ "Inside"+ ],+ [+ 25.494791,+ "the"+ ],+ [+ 25.651041,+ "absolute"+ ],+ [+ 26.145833,+ "value"+ ],+ [+ 26.575541,+ "of"+ ],+ [+ 26.679708,+ "negative"+ ],+ [+ 27.135416,+ "seven"+ ],+ [+ 27.8125,+ "is"+ ],+ [+ 27.916666,+ "seven"+ ],+ [+ 28.854166,+ "Careful"+ ],+ [+ 29.179708,+ "here"+ ],+ [+ 29.960958,+ "The"+ ],+ [+ 30.026041,+ "two"+ ],+ [+ 30.221375,+ "minus"+ ],+ [+ 30.625,+ "signs"+ ],+ [+ 31.158875,+ "don't"+ ],+ [+ 31.40625,+ "cancel"+ ],+ [+ 31.835958,+ "each"+ ],+ [+ 32.005208,+ "other"+ ],+ [+ 32.65625,+ "so"+ ],+ [+ 32.734375,+ "the"+ ],+ [+ 32.851583,+ "answer"+ ],+ [+ 33.28125,+ "is"+ ],+ [+ 33.411458,+ "not"+ ],+ [+ 33.684916,+ "seven"+ ],+ [+ 34.544291,+ "The"+ ],+ [+ 34.609375,+ "minus"+ ],+ [+ 35.039083,+ "outside"+ ],+ [+ 35.651041,+ "flips"+ ],+ [+ 36.315125,+ "seven"+ ],+ [+ 36.992208,+ "over"+ ],+ [+ 37.265625,+ "to"+ ],+ [+ 37.369791,+ "negative"+ ],+ [+ 37.851583,+ "seven"+ ],+ [+ 38.671875,+ "Inside"+ ],+ [+ 39.127625,+ "first"+ ],+ [+ 39.6875,+ "then"+ ],+ [+ 39.856791,+ "outside"+ ]+ ],+ "marks": {+ "six": 2.708,+ "inside": 9.115,+ "then": 12.917,+ "flip": 16.732,+ "seven": 19.779,+ "inside2": 24.505,+ "wrong": 28.854,+ "flip2": 34.544,+ "rule": 38.672+ },+ "cues": [+ [+ 0.104,+ "Sometimes there's a sign outside the bars."+ ],+ [+ 2.708,+ "This one says: negative, the absolute value of six."+ ],+ [+ 7.214,+ "Think inside, then outside."+ ],+ [+ 9.115,+ "Inside: the absolute value of six is six."+ ],+ [+ 12.917,+ "Outside: a minus sign in front means the opposite."+ ],+ [+ 16.732,+ "And the opposite of six is negative six."+ ],+ [+ 19.779,+ "Now try: negative, the absolute value of negative seven."+ ],+ [+ 24.505,+ "Inside: the absolute value of negative seven is seven."+ ],+ [+ 28.854,+ "Careful here."+ ],+ [+ 29.961,+ "The two minus signs don't cancel each other, so the answer is not seven."+ ],+ [+ 34.544,+ "The minus outside flips seven over to negative seven."+ ],+ [+ 38.672,+ "Inside first, then outside."+ ]+ ]+ },+ "q3": {+ "key": "76d92324c571851d6112bd46029b9acdcb83f7e6",+ "dur": 3.36,+ "words": [+ [+ 0.104166,+ "Quick"+ ],+ [+ 0.273458,+ "check"+ ],+ [+ 1.132833,+ "Inside"+ ],+ [+ 1.627625,+ "first"+ ],+ [+ 2.213541,+ "then"+ ],+ [+ 2.369791,+ "outside"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.133,+ "Inside first, then outside."+ ]+ ]+ },+ "times": {+ "key": "0615e21525f436a6bab42158b459187920225adc",+ "dur": 18.72,+ "words": [+ [+ 0.104166,+ "One"+ ],+ [+ 0.195333,+ "more"+ ],+ [+ 0.416666,+ "thing"+ ],+ [+ 1.197916,+ "A"+ ],+ [+ 1.25,+ "number"+ ],+ [+ 1.601583,+ "right"+ ],+ [+ 1.835958,+ "in"+ ],+ [+ 1.927083,+ "front"+ ],+ [+ 2.135416,+ "of"+ ],+ [+ 2.1745,+ "the"+ ],+ [+ 2.252625,+ "bars"+ ],+ [+ 2.760416,+ "means"+ ],+ [+ 3.177083,+ "multiply"+ ],+ [+ 4.505208,+ "just"+ ],+ [+ 4.635416,+ "like"+ ],+ [+ 4.739583,+ "a"+ ],+ [+ 4.778666,+ "number"+ ],+ [+ 5.130208,+ "in"+ ],+ [+ 5.234375,+ "front"+ ],+ [+ 5.45575,+ "of"+ ],+ [+ 5.507833,+ "parentheses"+ ],+ [+ 6.862,+ "Inside"+ ],+ [+ 7.33075,+ "first"+ ],+ [+ 8.242208,+ "the"+ ],+ [+ 8.359375,+ "absolute"+ ],+ [+ 8.867208,+ "value"+ ],+ [+ 9.257833,+ "of"+ ],+ [+ 9.348958,+ "negative"+ ],+ [+ 9.856791,+ "four"+ ],+ [+ 10.572916,+ "is"+ ],+ [+ 10.716166,+ "four"+ ],+ [+ 11.679708,+ "Then"+ ],+ [+ 12.005208,+ "multiply"+ ],+ [+ 13.229166,+ "two"+ ],+ [+ 13.4245,+ "times"+ ],+ [+ 13.763041,+ "four"+ ],+ [+ 14.583333,+ "Two"+ ],+ [+ 14.700541,+ "distances"+ ],+ [+ 15.221375,+ "of"+ ],+ [+ 15.286458,+ "four"+ ],+ [+ 16.197916,+ "laid"+ ],+ [+ 16.653666,+ "end"+ ],+ [+ 16.835958,+ "to"+ ],+ [+ 16.914083,+ "end"+ ],+ [+ 17.604166,+ "make"+ ],+ [+ 18.020833,+ "eight"+ ]+ ],+ "marks": {+ "front": 1.198,+ "inside": 6.862,+ "times": 11.68,+ "tapes": 14.583,+ "eight": 17.604+ },+ "cues": [+ [+ 0.104,+ "One more thing."+ ],+ [+ 1.198,+ "A number right in front of the bars means multiply, just like a number in front of parentheses."+ ],+ [+ 6.862,+ "Inside first: the absolute value of negative four is four."+ ],+ [+ 11.68,+ "Then multiply: two times four."+ ],+ [+ 14.583,+ "Two distances of four, laid end to end, make eight."+ ]+ ]+ },+ "ways": {+ "key": "5aa2fbecf83528b23021a28251d91a739daa9a91",+ "dur": 27.768,+ "words": [+ [+ 0.117208,+ "By"+ ],+ [+ 0.234375,+ "the"+ ],+ [+ 0.351583,+ "way"+ ],+ [+ 1.184916,+ "multiplication"+ ],+ [+ 2.122416,+ "can"+ ],+ [+ 2.252625,+ "be"+ ],+ [+ 2.421875,+ "written"+ ],+ [+ 2.838541,+ "in"+ ],+ [+ 2.96875,+ "several"+ ],+ [+ 3.528666,+ "ways"+ ],+ [+ 4.544291,+ "not"+ ],+ [+ 4.84375,+ "only"+ ],+ [+ 5.117208,+ "with"+ ],+ [+ 5.260416,+ "a"+ ],+ [+ 5.286458,+ "times"+ ],+ [+ 5.664083,+ "sign"+ ],+ [+ 6.458333,+ "You"+ ],+ [+ 6.536458,+ "can"+ ],+ [+ 6.653666,+ "use"+ ],+ [+ 6.901041,+ "a"+ ],+ [+ 6.979166,+ "dot"+ ],+ [+ 7.565125,+ "two"+ ],+ [+ 7.8125,+ "sets"+ ],+ [+ 8.164083,+ "of"+ ],+ [+ 8.242208,+ "parentheses"+ ],+ [+ 9.544291,+ "or"+ ],+ [+ 9.661458,+ "a"+ ],+ [+ 9.6875,+ "number"+ ],+ [+ 10.14325,+ "touching"+ ],+ [+ 10.46875,+ "parentheses"+ ],+ [+ 11.71875,+ "All"+ ],+ [+ 11.875,+ "of"+ ],+ [+ 11.953125,+ "these"+ ],+ [+ 12.1875,+ "mean"+ ],+ [+ 12.669291,+ "two"+ ],+ [+ 12.877625,+ "times"+ ],+ [+ 13.255208,+ "four"+ ],+ [+ 13.945333,+ "which"+ ],+ [+ 14.114583,+ "is"+ ],+ [+ 14.296875,+ "eight"+ ],+ [+ 15.052083,+ "With"+ ],+ [+ 15.208333,+ "letters"+ ],+ [+ 15.976583,+ "you"+ ],+ [+ 16.041666,+ "just"+ ],+ [+ 16.210958,+ "write"+ ],+ [+ 16.380208,+ "them"+ ],+ [+ 16.471375,+ "side"+ ],+ [+ 16.744791,+ "by"+ ],+ [+ 16.875,+ "side"+ ],+ [+ 17.760416,+ "a"+ ],+ [+ 17.851583,+ "b"+ ],+ [+ 17.994791,+ "means"+ ],+ [+ 18.203125,+ "a"+ ],+ [+ 18.255208,+ "times"+ ],+ [+ 18.710958,+ "b"+ ],+ [+ 19.596375,+ "and"+ ],+ [+ 20.026041,+ "three"+ ],+ [+ 20.416666,+ "x"+ ],+ [+ 20.729166,+ "means"+ ],+ [+ 20.989583,+ "three"+ ],+ [+ 21.341166,+ "times"+ ],+ [+ 21.796875,+ "x"+ ],+ [+ 22.721375,+ "A"+ ],+ [+ 22.786458,+ "letter"+ ],+ [+ 23.033875,+ "like"+ ],+ [+ 23.4245,+ "x"+ ],+ [+ 24.036458,+ "is"+ ],+ [+ 24.21875,+ "called"+ ],+ [+ 24.466166,+ "a"+ ],+ [+ 24.492208,+ "variable"+ ],+ [+ 25.520833,+ "It"+ ],+ [+ 25.585958,+ "stands"+ ],+ [+ 25.885416,+ "for"+ ],+ [+ 26.054708,+ "a"+ ],+ [+ 26.09375,+ "number"+ ],+ [+ 26.510416,+ "we"+ ],+ [+ 26.640625,+ "don't"+ ],+ [+ 26.848958,+ "know"+ ],+ [+ 26.992208,+ "yet"+ ]+ ],+ "marks": {+ "ways": 6.458,+ "same": 11.719,+ "var": 15.052,+ "ab": 17.76,+ "three": 19.596,+ "word": 22.721+ },+ "cues": [+ [+ 0.117,+ "By the way, multiplication can be written in several ways, not only with a times sign."+ ],+ [+ 6.458,+ "You can use a dot, two sets of parentheses, or a number touching parentheses."+ ],+ [+ 11.719,+ "All of these mean two times four, which is eight."+ ],+ [+ 15.052,+ "With letters, you just write them side by side."+ ],+ [+ 17.76,+ "a b means a times b, and three x means three times x."+ ],+ [+ 22.721,+ "A letter like x is called a variable."+ ],+ [+ 25.521,+ "It stands for a number we don't know yet."+ ]+ ]+ },+ "wrap": {+ "key": "8049e0f93c6338f3e7f019d4159a7e30dfee3ffc",+ "dur": 18.408,+ "words": [+ [+ 0.104166,+ "Let's"+ ],+ [+ 0.247416,+ "wrap"+ ],+ [+ 0.481791,+ "up"+ ],+ [+ 1.132833,+ "Absolute"+ ],+ [+ 1.5625,+ "value"+ ],+ [+ 2.083333,+ "is"+ ],+ [+ 2.265625,+ "distance"+ ],+ [+ 2.721375,+ "from"+ ],+ [+ 2.890625,+ "zero"+ ],+ [+ 3.828125,+ "It's"+ ],+ [+ 3.932291,+ "never"+ ],+ [+ 4.20575,+ "negative"+ ],+ [+ 4.987,+ "and"+ ],+ [+ 5.2995,+ "opposites"+ ],+ [+ 5.76825,+ "share"+ ],+ [+ 6.015625,+ "the"+ ],+ [+ 6.09375,+ "same"+ ],+ [+ 6.757833,+ "absolute"+ ],+ [+ 7.278666,+ "value"+ ],+ [+ 8.164083,+ "The"+ ],+ [+ 8.242208,+ "bars"+ ],+ [+ 8.606791,+ "group"+ ],+ [+ 9.375,+ "work"+ ],+ [+ 9.583333,+ "inside"+ ],+ [+ 9.973958,+ "first"+ ],+ [+ 10.76825,+ "then"+ ],+ [+ 10.872416,+ "apply"+ ],+ [+ 11.40625,+ "any"+ ],+ [+ 11.614583,+ "sign"+ ],+ [+ 11.953125,+ "outside"+ ],+ [+ 12.95575,+ "And"+ ],+ [+ 13.020833,+ "a"+ ],+ [+ 13.059916,+ "number"+ ],+ [+ 13.372416,+ "in"+ ],+ [+ 13.463541,+ "front"+ ],+ [+ 13.658875,+ "of"+ ],+ [+ 13.697916,+ "the"+ ],+ [+ 13.776041,+ "bars"+ ],+ [+ 14.492208,+ "means"+ ],+ [+ 14.84375,+ "multiply"+ ],+ [+ 16.210958,+ "Now"+ ],+ [+ 16.601583,+ "try"+ ],+ [+ 16.770833,+ "the"+ ],+ [+ 16.848958,+ "chapter"+ ],+ [+ 17.265625,+ "practice"+ ]+ ],+ "marks": {+ "w1": 1.133,+ "w2": 3.828,+ "w3": 8.164,+ "w4": 12.956,+ "end": 16.211+ },+ "cues": [+ [+ 0.104,+ "Let's wrap up."+ ],+ [+ 1.133,+ "Absolute value is distance from zero."+ ],+ [+ 3.828,+ "It's never negative, and opposites share the same absolute value."+ ],+ [+ 8.164,+ "The bars group: work inside first, then apply any sign outside."+ ],+ [+ 12.956,+ "And a number in front of the bars means multiply."+ ],+ [+ 16.211,+ "Now try the chapter practice."+ ]+ ]+ },+ "final1": {+ "key": "749fc09b5932cbf358aeeb05db8d1a7b311ad830",+ "dur": 3.792,+ "words": [+ [+ 0.104166,+ "Chapter"+ ],+ [+ 0.416666,+ "practice"+ ],+ [+ 1.5625,+ "Find"+ ],+ [+ 2.109375,+ "each"+ ],+ [+ 2.408875,+ "absolute"+ ],+ [+ 2.96875,+ "value"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Chapter practice."+ ],+ [+ 1.562,+ "Find each absolute value."+ ]+ ]+ },+ "final2": {+ "key": "49cac16612e997c2acac726b3fa224d69b602876",+ "dur": 3.216,+ "words": [+ [+ 0.091166,+ "Now"+ ],+ [+ 0.221375,+ "some"+ ],+ [+ 0.390625,+ "with"+ ],+ [+ 0.520833,+ "work"+ ],+ [+ 0.807291,+ "inside"+ ],+ [+ 1.588541,+ "or"+ ],+ [+ 1.744791,+ "outside"+ ],+ [+ 2.226583,+ "the"+ ],+ [+ 2.278666,+ "bars"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.091,+ "Now some with work inside or outside the bars."+ ]+ ]+ },+ "final3": {+ "key": "8aa3ac44dbcac6aa95cfe34308767aa70239466b",+ "dur": 2.424,+ "words": [+ [+ 0.104166,+ "Absolute"+ ],+ [+ 0.612,+ "value"+ ],+ [+ 1.08075,+ "in"+ ],+ [+ 1.197916,+ "the"+ ],+ [+ 1.276041,+ "real"+ ],+ [+ 1.614583,+ "world"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Absolute value in the real world."+ ]+ ]+ },+ "final4": {+ "key": "38784a91bdf140cc66ee6801b487b6d91846ca92",+ "dur": 2.616,+ "words": [+ [+ 0.104166,+ "Last"+ ],+ [+ 0.416666,+ "set"+ ],+ [+ 1.197916,+ "True"+ ],+ [+ 1.5625,+ "or"+ ],+ [+ 1.666666,+ "false"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "Last set."+ ],+ [+ 1.198,+ "True or false?"+ ]+ ]+ },+ "finish": {+ "key": "b6ce91c8953cfb21bf35cb84e694ef055aabf5bc",+ "dur": 2.592,+ "words": [+ [+ 0.104166,+ "That's"+ ],+ [+ 0.247416,+ "chapter"+ ],+ [+ 0.664083,+ "three"+ ],+ [+ 1.5495,+ "Nice"+ ],+ [+ 1.809916,+ "work"+ ]+ ],+ "marks": {},+ "cues": [+ [+ 0.104,+ "That's chapter three."+ ],+ [+ 1.55,+ "Nice work."+ ]+ ]+ }+}\ No newline at end of filediff --git a/plan.md b/plan.mdindex 7e300e8..1ba57b0 100644--- a/plan.md+++ b/plan.md@@ -4,6 +4,8 @@> 本文供后续参与项目的 agents 阅读和执行。明确标注的“候选”“建议”“待定”不等于已经获得用户确认。> 当前阶段重点审阅全书与书架,检查动画编排;未确认的 Skill 封装和新书制作范围继续讨论。+> 2026-10-03:按用户要求,将 Book2 的第二本书 *Ace Math & the Big Fat Notebook* 合并到本项目;现有三章、动画、MP3、讲稿、分镜、章节规划、原始参考资料和检查脚本已迁入,首页书架增加入口。第二本保留独立引擎与学习进度,第一本原有路径保持兼容。这次合并仅在本地完成,未发布;第二本后续章节因 API 成本暂停。+## 1. 项目目标以现有的预代数与代数 I 教材为参考,重新创作一本带有动画讲解、数学交互和自动判题的双语练习册,最终交付可部署到远程的静态站点。@@ -24,7 +26,7 @@目录页每个单元的标题区是一条“黑板带”(用户 2026-10-03 指出目录页太单调):右侧是该单元数学内容的粉笔线条小图,用单元颜色绘制,背后一层同色柔光;单元第一次滚动进入视野时逐笔画出,之后保留一个与内容相关的小循环动作(如交换律中 a、b 互换,数轴上跳点,饼图填充,天平摆动,坐标线上走点,转盘转动,函数机器进出,面积格依次亮起,平方差缺角闪现,√2 对角线重画,根点脉动,抛物线伸缩)。全部由代码绘制,不使用外部图片;图画在 `site/lib/unit-art.js`,样式与动作在 `site/index.html`;系统设置减少动态时只显示静态完成图。-书架样式与数据在 `site/lib/bookshelf.css` 和 `site/lib/bookshelf.js`,数学书的章节和单元数量由现有目录自动读取。入口不带 hash 时展示书架,`#book` 展示数学书封面,`#contents` / `#chNN` 展示目录;原有章节链接和引擎路径保持兼容。新书发布时增加独立目录及书架条目,不展示未制作的占位作品。+书架样式与数据在 `site/lib/bookshelf.css` 和 `site/lib/bookshelf.js`,第一本数学书的章节和单元数量由现有目录自动读取。入口不带 hash 时展示书架,`#book` 展示第一本书封面,`#contents` / `#chNN` 展示其目录;原有章节链接和引擎路径保持兼容。第二本位于 `site/math-notebook/`,书架列出当前可用的 3 章、1 个单元;63 章、6 个单元的全书规划仅在制作资料中记录,不显示未制作的章节入口。新书增加独立目录及书架条目,不展示未制作的占位作品。## 2. 已确定的要求diff --git a/site/lib/bookshelf.js b/site/lib/bookshelf.jsindex e6f7eef..5b5ed5b 100644--- a/site/lib/bookshelf.js+++ b/site/lib/bookshelf.js@@ -11,6 +11,29 @@href: '#book', coverTitle: ['Pre-Algebra', '& Algebra'], series: 'An animated workbook',description: 'From the first number line to the shape of an equation. See the math unfold, one idea at a time.',contents: '#units',+ }, {+ id: 'math-notebook', title: 'Ace Math & the Big Fat Notebook', subject: 'Mathematics',+ href: 'math-notebook/', coverTitle: ['Ace Math', '& the Big Fat Notebook'], series: 'An animated workbook',+ description: 'Explore middle-school math as numbers find their families, cross zero, and reveal their distance along the number line.',+ chapters: 3, units: 1,+ features: ['3 narrated chapters available', 'Sort numbers and explore the number line', 'Quick checks and chapter practice'],+ artwork: `<svg viewBox="0 0 260 175" class="book-art" style="height:90px" aria-hidden="true">+ <g fill="none" stroke-width="2" stroke-linecap="round">+ <ellipse cx="130" cy="66" rx="96" ry="48" stroke="#bba8ee"/>+ <ellipse cx="107" cy="66" rx="68" ry="37" stroke="#e8a0c8"/>+ <ellipse cx="91" cy="66" rx="46" ry="27" stroke="#f3c95c"/>+ <ellipse cx="80" cy="66" rx="29" ry="17" stroke="#86c9e8"/>+ <ellipse cx="73" cy="66" rx="16" ry="9" stroke="#f4a48c"/>+ <path d="M27 141H233 M31 137L27 141L31 145 M229 137L233 141L229 145" stroke="#a8c6ba"/>+ <path d="M62 136V146 M96 136V146 M130 133V149 M164 136V146 M198 136V146" stroke="#a8c6ba"/>+ <path d="M62 125V120H198V125" stroke="#f0b45a"/>+ </g>+ <circle cx="62" cy="141" r="4" fill="#f4a48c"/>+ <circle cx="198" cy="141" r="4" fill="#86c9e8"/>+ <g fill="#d3ded5" font-family="Georgia,serif" font-size="13" text-anchor="middle">+ <text x="62" y="164">−2</text><text x="130" y="164">0</text><text x="198" y="164">2</text>+ </g>+ </svg>`,}];const el = (tag, cls, text) => {const node = document.createElement(tag);diff --git a/site/math-notebook/ch01/audio/en/final1.mp3 b/site/math-notebook/ch01/audio/en/final1.mp3new file mode 100644index 0000000..b554e38Binary files /dev/null and b/site/math-notebook/ch01/audio/en/final1.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/final2.mp3 b/site/math-notebook/ch01/audio/en/final2.mp3new file mode 100644index 0000000..cb8f0a0Binary files /dev/null and b/site/math-notebook/ch01/audio/en/final2.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/final3.mp3 b/site/math-notebook/ch01/audio/en/final3.mp3new file mode 100644index 0000000..b538379Binary files /dev/null and b/site/math-notebook/ch01/audio/en/final3.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/finish.mp3 b/site/math-notebook/ch01/audio/en/finish.mp3new file mode 100644index 0000000..45ef858Binary files /dev/null and b/site/math-notebook/ch01/audio/en/finish.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/integers.mp3 b/site/math-notebook/ch01/audio/en/integers.mp3new file mode 100644index 0000000..db74231Binary files /dev/null and b/site/math-notebook/ch01/audio/en/integers.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/intro.mp3 b/site/math-notebook/ch01/audio/en/intro.mp3new file mode 100644index 0000000..7c2636bBinary files /dev/null and b/site/math-notebook/ch01/audio/en/intro.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/irrational.mp3 b/site/math-notebook/ch01/audio/en/irrational.mp3new file mode 100644index 0000000..a6924cdBinary files /dev/null and b/site/math-notebook/ch01/audio/en/irrational.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/line.mp3 b/site/math-notebook/ch01/audio/en/line.mp3new file mode 100644index 0000000..941c8d3Binary files /dev/null and b/site/math-notebook/ch01/audio/en/line.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/natural.mp3 b/site/math-notebook/ch01/audio/en/natural.mp3new file mode 100644index 0000000..6bd1820Binary files /dev/null and b/site/math-notebook/ch01/audio/en/natural.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/place.mp3 b/site/math-notebook/ch01/audio/en/place.mp3new file mode 100644index 0000000..f313bc6Binary files /dev/null and b/site/math-notebook/ch01/audio/en/place.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/q1.mp3 b/site/math-notebook/ch01/audio/en/q1.mp3new file mode 100644index 0000000..b10913bBinary files /dev/null and b/site/math-notebook/ch01/audio/en/q1.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/q2.mp3 b/site/math-notebook/ch01/audio/en/q2.mp3new file mode 100644index 0000000..836ea5dBinary files /dev/null and b/site/math-notebook/ch01/audio/en/q2.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/q3.mp3 b/site/math-notebook/ch01/audio/en/q3.mp3new file mode 100644index 0000000..d3697e6Binary files /dev/null and b/site/math-notebook/ch01/audio/en/q3.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/rational.mp3 b/site/math-notebook/ch01/audio/en/rational.mp3new file mode 100644index 0000000..407a240Binary files /dev/null and b/site/math-notebook/ch01/audio/en/rational.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/real.mp3 b/site/math-notebook/ch01/audio/en/real.mp3new file mode 100644index 0000000..f6ee960Binary files /dev/null and b/site/math-notebook/ch01/audio/en/real.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/repeat.mp3 b/site/math-notebook/ch01/audio/en/repeat.mp3new file mode 100644index 0000000..f388b8aBinary files /dev/null and b/site/math-notebook/ch01/audio/en/repeat.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/timings.js b/site/math-notebook/ch01/audio/en/timings.jsnew file mode 100644index 0000000..a3b5a32--- /dev/null+++ b/site/math-notebook/ch01/audio/en/timings.js@@ -0,0 +1,515 @@+window.TIMINGS = {+ "intro": {+ "dur": 9.192,+ "marks": {+ "sub": 3.607+ },+ "cues": [+ [+ 0.104,+ "Chapter one."+ ],+ [+ 1.107,+ "Types of numbers, and the number line."+ ],+ [+ 3.607,+ "Every number belongs to a family, and some numbers belong to several families at once."+ ]+ ]+ },+ "natural": {+ "dur": 17.4,+ "marks": {+ "one": 4.05,+ "ring": 8.151,+ "nofrac": 12.682+ },+ "cues": [+ [+ 0.104,+ "Let's start with the numbers you learned first: the ones you count with."+ ],+ [+ 4.05,+ "One, two, three, four, five, and on and on."+ ],+ [+ 8.151,+ "These are the natural numbers."+ ],+ [+ 9.831,+ "Some teachers call them the counting numbers."+ ],+ [+ 12.682,+ "No zero, no fractions, no negatives."+ ],+ [+ 16.354,+ "Just counting."+ ]+ ]+ },+ "whole": {+ "dur": 17.736,+ "marks": {+ "zero": 1.667,+ "ring": 2.591,+ "around": 6.51,+ "still": 12.617+ },+ "cues": [+ [+ 0.104,+ "Now add one more number: zero."+ ],+ [+ 2.591,+ "The natural numbers plus zero make the whole numbers."+ ],+ [+ 6.51,+ "Notice the new ring goes around the old one."+ ],+ [+ 9.479,+ "Every natural number is also a whole number."+ ],+ [+ 12.617,+ "Whole numbers still have no fractions, no decimals, and nothing negative."+ ]+ ]+ },+ "integers": {+ "dur": 21.936,+ "marks": {+ "neg": 2.214,+ "ring": 6.823,+ "around": 11.237,+ "note": 17.018+ },+ "cues": [+ [+ 0.104,+ "What about numbers below zero?"+ ],+ [+ 2.214,+ "Negative one, negative two, negative three, and so on."+ ],+ [+ 6.823,+ "Put the whole numbers together with their negatives, and you get the integers."+ ],+ [+ 11.237,+ "Again, the new ring wraps around the old ones."+ ],+ [+ 14.557,+ "Every whole number is an integer too."+ ],+ [+ 17.018,+ "Integers are still whole steps: no fractions, no decimals."+ ]+ ]+ },+ "q1": {+ "dur": 4.248,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.185,+ "Pick every family each number belongs to."+ ]+ ]+ },+ "rational": {+ "dur": 32.592,+ "marks": {+ "ratio": 2.031,+ "half": 10.169,+ "quarter": 12.461,+ "d412": 16.237,+ "seven": 19.674,+ "ring": 28.737+ },+ "cues": [+ [+ 0.104,+ "Next up: fractions."+ ],+ [+ 2.031,+ "A rational number is any number you can write as one integer divided by another."+ ],+ [+ 7.63,+ "Think of its root word: ratio."+ ],+ [+ 10.169,+ "One half is rational."+ ],+ [+ 12.031,+ "So is zero point two five, because it equals one fourth."+ ],+ [+ 16.237,+ "Four point one two is four hundred twelve hundredths."+ ],+ [+ 19.674,+ "Here's the surprise: negative seven is rational too, because it's negative seven over one."+ ],+ [+ 26.172,+ "Every integer can be written that way."+ ],+ [+ 28.737,+ "So the rational ring goes around all the integers."+ ]+ ]+ },+ "repeat": {+ "dur": 21.36,+ "marks": {+ "div": 1.784,+ "bar": 8.346,+ "rule": 13.841,+ "fly": 18.776+ },+ "cues": [+ [+ 0.078,+ "What about one third?"+ ],+ [+ 1.784,+ "Divide one by three and you get zero point three three three, and the threes never stop."+ ],+ [+ 8.346,+ "We write that with a little bar over the three."+ ],+ [+ 10.729,+ "The bar means: this part repeats forever."+ ],+ [+ 13.841,+ "So a decimal that ends, or a decimal that repeats, is rational."+ ],+ [+ 18.776,+ "One third goes in the rational ring."+ ]+ ]+ },+ "irrational": {+ "dur": 39.672,+ "marks": {+ "pi": 3.359,+ "root": 11.263,+ "ring": 17.917,+ "sep": 23.359,+ "proof": 30.846+ },+ "cues": [+ [+ 0.117,+ "But some numbers can't be written as a fraction at all."+ ],+ [+ 3.359,+ "Pi is three point one four one five nine two six five, and it keeps going, with no block of digits that repeats."+ ],+ [+ 11.263,+ "The square root of two is one point four one four two one three, and it never repeats either."+ ],+ [+ 17.917,+ "These are irrational numbers."+ ],+ [+ 19.805,+ "Their decimals never end and never repeat."+ ],+ [+ 23.359,+ "They get their own ring, outside the rational numbers."+ ],+ [+ 26.875,+ "A number is rational or irrational, never both."+ ],+ [+ 30.846,+ "By the way, a few digits can't prove a number is irrational."+ ],+ [+ 35.378,+ "Mathematicians proved it for pi and the square root of two."+ ]+ ]+ },+ "real": {+ "dur": 17.808,+ "marks": {+ "ring": 0.924,+ "ex": 8.086,+ "int": 9.427,+ "rat": 10.573,+ "real": 12.383,+ "nest": 13.477+ },+ "cues": [+ [+ 0.169,+ "Finally, put the rational and irrational numbers together."+ ],+ [+ 4.154,+ "These are the real numbers: every number you can find on a number line."+ ],+ [+ 8.086,+ "Take negative two."+ ],+ [+ 9.427,+ "It's an integer, so it's also rational, and it's real."+ ],+ [+ 13.477,+ "A number belongs to its own ring and to every ring around it."+ ]+ ]+ },+ "q2": {+ "dur": 3.624,+ "marks": {},+ "cues": [+ [+ 0.091,+ "Quick check."+ ],+ [+ 1.133,+ "Put each number in its smallest ring."+ ]+ ]+ },+ "line": {+ "dur": 18.96,+ "marks": {+ "line": 1.927,+ "dir": 4.362,+ "two": 7.956,+ "three": 13.034+ },+ "cues": [+ [+ 0.104,+ "Now let's line the numbers up."+ ],+ [+ 1.927,+ "A number line puts numbers in order."+ ],+ [+ 4.362,+ "Smaller numbers are on the left."+ ],+ [+ 6.263,+ "Larger numbers are on the right."+ ],+ [+ 7.956,+ "Two is larger than one and larger than zero, so it sits to their right."+ ],+ [+ 13.034,+ "Negative three is smaller than negative two and negative one, so it sits to their left."+ ]+ ]+ },+ "place": {+ "dur": 32.712,+ "marks": {+ "f1": 2.487,+ "a": 4.141,+ "b": 8.893,+ "c": 13.125,+ "d": 15.833,+ "e": 20.951,+ "irr": 23.724,+ "all": 29.193+ },+ "cues": [+ [+ 0.104,+ "Every rational number has a spot, not just the integers."+ ],+ [+ 4.141,+ "Negative two point three eight sits a little past negative two."+ ],+ [+ 8.893,+ "Negative three fourths is between negative one and zero."+ ],+ [+ 13.125,+ "One half is halfway from zero to one."+ ],+ [+ 15.833,+ "And the square root of four?"+ ],+ [+ 17.669,+ "It looks irrational, but it's exactly two."+ ],+ [+ 20.951,+ "Three and one eighth is just past three."+ ],+ [+ 23.724,+ "Irrational numbers have spots too."+ ],+ [+ 25.885,+ "The square root of two is about one point four one."+ ],+ [+ 29.193,+ "Together, the real numbers fill the whole line."+ ]+ ]+ },+ "q3": {+ "dur": 3.048,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.172,+ "Find the points on the number line."+ ]+ ]+ },+ "wrap": {+ "dur": 28.92,+ "marks": {+ "w1": 1.003,+ "w2": 8.737,+ "w3": 14.675,+ "w4": 22.721,+ "end": 26.797+ },+ "cues": [+ [+ 0.104,+ "To sum up."+ ],+ [+ 1.003,+ "Each family adds new numbers: zero for the whole numbers, negatives for the integers, fractions for the rationals."+ ],+ [+ 8.737,+ "Rational numbers can be written as a fraction."+ ],+ [+ 11.953,+ "Their decimals end or repeat."+ ],+ [+ 14.675,+ "Irrational decimals never end and never repeat."+ ],+ [+ 18.581,+ "Rational and irrational together make the real numbers."+ ],+ [+ 22.721,+ "On a number line, smaller is left and larger is right."+ ],+ [+ 26.797,+ "Now try the chapter practice."+ ]+ ]+ },+ "final1": {+ "dur": 5.496,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Chapter practice."+ ],+ [+ 1.523,+ "Classify each number in every family it belongs to."+ ]+ ]+ },+ "final2": {+ "dur": 2.04,+ "marks": {},+ "cues": [+ [+ 0.13,+ "Four more numbers to classify."+ ]+ ]+ },+ "final3": {+ "dur": 3.0,+ "marks": {},+ "cues": [+ [+ 0.091,+ "Last one."+ ],+ [+ 1.081,+ "Left or right of zero?"+ ]+ ]+ },+ "finish": {+ "dur": 2.904,+ "marks": {},+ "cues": [+ [+ 0.091,+ "Nice work."+ ],+ [+ 1.198,+ "That's the end of chapter one."+ ]+ ]+ }+};diff --git a/site/math-notebook/ch01/audio/en/whole.mp3 b/site/math-notebook/ch01/audio/en/whole.mp3new file mode 100644index 0000000..4a015afBinary files /dev/null and b/site/math-notebook/ch01/audio/en/whole.mp3 differdiff --git a/site/math-notebook/ch01/audio/en/wrap.mp3 b/site/math-notebook/ch01/audio/en/wrap.mp3new file mode 100644index 0000000..dccc328Binary files /dev/null and b/site/math-notebook/ch01/audio/en/wrap.mp3 differdiff --git a/site/math-notebook/ch01/index.html b/site/math-notebook/ch01/index.htmlnew file mode 100644index 0000000..2aa0ab3--- /dev/null+++ b/site/math-notebook/ch01/index.html@@ -0,0 +1,304 @@+<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<title>Types of Numbers and the Number Line</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 -->+<style>+ .screen .grid .row { grid-template-columns: 260px minmax(0, 1fr) 40px; }+ .screen .grid .why { padding-left: 276px; }+ .screen .grid.text .row { grid-template-columns: minmax(0, 1fr) auto 40px; }+ .screen .grid.text .why { padding-left: 0; }+ .side .grid .row { grid-template-columns: 70px minmax(0, 1fr) 34px; }+ .side .grid .why { padding-left: 86px; }+</style>+</head>+<body>+<script src="../lib/engine.js"></script>+<script src="audio/en/timings.js"></script>+<script>+'use strict';+const CHAPTER = { number: 1, title: 'Types of Numbers and the Number Line', minutes: 9, language: 'en', next: '../ch02/' };+AXIS.u = 160; // number line −4…4 across the stage++/* ---------- chapter drawing helpers ---------- */+const SX = 1290; // left edge of the notes beside the number map+const mline = (p, parts, x, y, t0, fill = COL.chalk, size = 48, anchor = 'middle') => { const e = M(p, [].concat(parts), { x, y, size, fill, anchor, o: 0 }); show(e, t0); return e; };+const text = (p, str, x, y, t0, { size = 30, fill = COL.chalk, anchor = 'start', weight = 500, font = UI } = {}) => { const e = T(p, str, { x, y, size, fill, anchor, weight, font, o: 0 }); show(e, t0); return e; };+// Notes beside the map: a family name and a short line under it.+// The title opens the beat; the lines follow the words.+function note(p, title, k, lines, t0) {+ text(p, title, SX, 230, .3, { size: 36, fill: COL[k], weight: 700 });+ lines.forEach((l, i) => text(p, l, SX, 276 + i * 36, t0 + i * .3, { size: 26, fill: COL.dim }));+}+// Draw one ring of the number map: outline, then its fill and name.+function ringIn(k, t0) {+ const r = S.ring[k];+ draw(r.stroke, t0, 1.1); show(r.fill, t0 + .5, .7); show(r.lab, t0 + .8, .5);+}+// A number that lives in the map, in its family's colour.+function vnum(parts, k, x, y, t0, size = 36) {+ const e = M(S.vnums, [].concat(parts), { x, y, size, fill: COL[k], o: 0, s: .6 });+ pop(e, t0);+ return e;+}+// A copy of a number flies from the notes into its ring.+function fly(parts, k, from, to, t0, size = 36) {+ const e = M(S.vnums, [].concat(parts), { x: from[0], y: from[1], size, fill: COL[k], o: 0 });+ show(e, t0, .2); tw(e, { x: to[0], y: to[1] }, t0 + .25, 1, io);+ return e;+}+// "left = right" in the notes, aligned on '='. Returns the centre of the left side.+const XE = 1420;+function sideEq(p, L, R, y, t0, fill = COL.chalk, size = 38) {+ mline(p, L, XE - 24, y, t0, fill, size, 'end');+ mline(p, ['='], XE, y, t0, COL.dim, size);+ mline(p, R, XE + 24, y, t0 + .25, COL.chalk, size, 'start');+ return [XE - 24 - mathW(L, size) / 2, y];+}+// A labelled point on the number line: dot, leader, label above (or below).+function mark(p, v, label, t0, col = COL.rat, below = false) {+ const x = X(v), d = below ? 1 : -1;+ landDot(p, v, t0, col);+ draw(path(p, `M${x} ${Y0 + d * 18}V${Y0 + d * 64}`, { stroke: col, 'stroke-width': 3 }, { d: 0 }), t0 + .2, .3);+ return mline(p, label, x, below ? Y0 + 112 : Y0 - 102, t0 + .35, col, 36);+}+// Arrow along y from x1 to x2 with a word over it.+function dirArrow(p, x1, x2, y, word, t0) {+ const d = Math.sign(x2 - x1);+ draw(path(p, `M${x1} ${y}H${x2}M${x2 - 14 * d} ${y - 10}L${x2} ${y}L${x2 - 14 * d} ${y + 10}`, { stroke: COL.dim, 'stroke-width': 3 }, { d: 0 }), t0, .6);+ text(p, word, (x1 + x2) / 2, y - 22, t0 + .2, { size: 28, fill: COL.dim, anchor: 'middle', weight: 600 });+}+// Tap points on the line, with visible dots at the candidates.+const tapDots = (vals, ...rest) => (body, api) => {+ const ctl = tap(vals, ...rest)(body, api);+ for (const v of vals) {+ const g = landDot(S.q, v, 0, COL.task, fx);+ g.style.pointerEvents = 'none';+ S.dots[v] = g;+ }+ return ctl;+};+const RING3 = FAM_COLS.slice(0, 3);+const Q1POS = { x: 900, y: 110, w: 680, cls: 'side', maxH: 640 };++/* ---------- beats: [id, title, run(m, D), { ask }?] ---------- */+const BEATS = [+ ['intro', 'Types of numbers', (m, D) => {+ const g = G(scene, { o: 0, y: 24 });+ T(g, 'Unit 1 · The Number System · Chapter 1', { x: 800, y: 300, size: 28, fill: COL.dim, anchor: 'middle' });+ T(g, 'Types of Numbers', { x: 800, y: 410, size: 84, weight: 600, anchor: 'middle' });+ T(g, 'and the Number Line', { x: 800, y: 510, size: 84, weight: 600, anchor: 'middle' });+ tw(g, { o: 1, y: 0 }, .2, 1.1, out);+ const fam = G(scene, { o: 0 });+ ['nat', 'whole', 'int', 'rat', 'irr', 'real'].forEach((k, i) => mk('circle', { cx: 650 + i * 60, cy: 580, r: 10, fill: COL[k] }, fam));+ show(fam, .9, .8);+ const r = text(scene, 'Every number belongs to a family — sometimes to several.', 800, 680, m('sub'), { size: 34, fill: COL.dim, anchor: 'middle' });+ tw(g, { o: 0, y: -24 }, D - .9, .8); hide(r, D - .9, .8); hide(fam, D - .9, .8);+ }],+ ['natural', 'Natural numbers', (m) => {+ const p = panel(0);+ S.ring = buildVenn(S.venn, true);+ S.vnums = G(S.venn);+ S.n = {};+ // counting: one number per word, then the ring closes around them+ [['1', 440, 592], ['2', 500, 592], ['3', 560, 592], ['4', 470, 646], ['5', 530, 646]].forEach(([v, x, y], i) => { S.n[v] = vnum(v, 'nat', x, y, i ? m('one', i * .55) : .3); });+ pulse(S.n['1'], m('one'), 1.3);+ mline(S.vnums, '…', 580, 646, m('one', 2.8), COL.nat, 36);+ ringIn('nat', m('ring'));+ note(p, 'Natural numbers', 'nat', ['the counting numbers'], m('ring', .4));+ mline(p, '1, 2, 3, 4, 5, …', SX, 360, m('ring', 1.4), COL.nat, 36, 'start');+ text(p, 'no 0, no fractions,', SX, 430, m('nofrac'), { size: 26, fill: COL.dim });+ text(p, 'no negatives', SX, 466, m('nofrac', .3), { size: 26, fill: COL.dim });+ }],+ ['whole', 'Whole numbers', (m) => {+ const p = panel(0);+ S.n['0'] = vnum('0', 'whole', 333, 582, m('zero'), 40);+ ringIn('whole', m('ring'));+ note(p, 'Whole numbers', 'whole', ['natural numbers and 0'], m('ring', .4));+ mline(p, '0, 1, 2, 3, 4, …', SX, 360, m('ring', 1.4), COL.whole, 36, 'start');+ glow('nat', m('around', .3)); glow('whole', m('around', .7));+ text(p, 'still no fractions,', SX, 430, m('still'), { size: 26, fill: COL.dim });+ text(p, 'decimals or negatives', SX, 466, m('still', .3), { size: 26, fill: COL.dim });+ }],+ ['integers', 'Integers', (m) => {+ const p = panel(0);+ [['−1', 263, 466], ['−2', 258, 530], ['−3', 258, 594]].forEach(([v, x, y], i) => { S.n[v] = vnum(v, 'int', x, y, m('neg', i * .75)); });+ mline(S.vnums, '…', 280, 648, m('neg', 2.4), COL.int, 36);+ ringIn('int', m('ring'));+ note(p, 'Integers', 'int', ['whole numbers', 'and their negatives'], m('ring', .4));+ mline(p, '…, −2, −1, 0, 1, 2, …', SX, 396, m('ring', 1.6), COL.int, 32, 'start');+ glow('whole', m('around', .3)); glow('int', m('around', .7));+ text(p, 'whole steps only:', SX, 466, m('note'), { size: 26, fill: COL.dim });+ text(p, 'no fractions or decimals', SX, 502, m('note', .3), { size: 26, fill: COL.dim });+ }],+ ['q1', 'Quick check', () => { panel(0); }, { ask: done => quiz(Q1POS, [{+ id: 'c-families', prompt: ['Pick ', h('b', '', 'every'), ' family each number belongs to.'],+ build: grid([+ { parts: ['−4'], ans: ['int'], why: '−4 is negative, so it is not whole or natural. It is an integer.', fx: () => glowFx('int') },+ { parts: ['0'], ans: ['whole', 'int'], why: '0 is whole (and so an integer), but counting starts at 1, so it is not natural.', fx: () => glowFx('whole') },+ { parts: ['9'], ans: ['nat', 'whole', 'int'], why: '9 is a counting number, so it is in every ring around Natural.', fx: () => glowFx('nat') },+ ], RING3),+ }], done) }],+ ['rational', 'Rational numbers', (m) => {+ const p = panel(0);+ note(p, 'Rational numbers', 'rat', ['one integer over another'], m('ratio'));+ text(p, 'think: ratio', SX, 318, m('ratio', 2.6), { size: 26, fill: COL.task, weight: 600 });+ const a = sideEq(p, [F(1, 2)], ['0.5'], 400, m('half'), COL.rat);+ fly([F(1, 2)], 'rat', a, [150, 468], m('half', .9));+ const b = sideEq(p, ['0.25'], [F(1, 4)], 480, m('quarter'), COL.rat);+ fly(['0.25'], 'rat', b, [150, 566], m('quarter', 1.6));+ const c = sideEq(p, ['4.12'], [F(412, 100)], 560, m('d412'), COL.rat);+ fly(['4.12'], 'rat', c, [850, 470], m('d412', 1.4));+ const d = sideEq(p, ['−7'], [F('−7', 1)], 640, m('seven', .9), COL.int);+ S.n['−7'] = fly(['−7'], 'int', d, [755, 540], m('seven', 2.4));+ ringIn('rat', m('ring', .2));+ glow('int', m('ring', 1.4)); glow('rat', m('ring', 1.8));+ }],+ ['repeat', 'Repeating decimals', (m) => {+ const p = panel(0);+ mline(p, [F(1, 3), ' = 1 ÷ 3'], SX, 260, .3, COL.chalk, 40, 'start');+ const t = T(p, '', { x: SX, y: 350, size: 40, font: MATH, fill: COL.chalk });+ stream(t, '0.33333333333…', m('div'), 3.2);+ hide(t, m('bar'), .4);+ const bar = M(S.vnums, ['0.', OV('3')], { x: SX + mathW(['0.', OV('3')], 40) / 2, y: 350, size: 40, fill: COL.rat, o: 0 });+ show(bar, m('bar', .3));+ text(p, 'the bar: repeats forever', SX, 410, m('bar', .9), { size: 24, fill: COL.dim });+ text(p, 'decimal ends or repeats', SX, 490, m('rule'), { size: 26, fill: COL.rat, weight: 600 });+ text(p, '→ rational', SX, 526, m('rule', .5), { size: 26, fill: COL.rat, weight: 600 });+ mline(p, ['0.', OV('3')], SX, 350, m('fly'), COL.rat, 40, 'start'); // stays in the notes while its copy flies+ tw(bar, { x: 850, y: 560, s: .9 }, m('fly'), 1);+ pulse(S.ring.rat.lab, m('fly', 1.1), 1.15);+ }],+ ['irrational', 'Irrational numbers', (m) => {+ const p = panel(0);+ const pi = T(p, 'π = ', { x: SX, y: 260, size: 40, font: MATH, fill: COL.irr, o: 0 });+ show(pi, .3);+ stream(T(p, '', { x: SX + textW('π = ', 40), y: 260, size: 40, font: MATH, fill: COL.chalk }), '3.14159265…', m('pi'), 3.4);+ mline(p, [R(2), ' = '], SX, 340, m('root'), COL.irr, 40, 'start');+ stream(T(p, '', { x: SX + mathW([R(2), ' = '], 40), y: 340, size: 40, font: MATH, fill: COL.chalk }), '1.414213…', m('root', .4), 3);+ ringIn('irr', m('ring'));+ text(p, 'never ends,', SX, 430, m('ring', 1.6), { size: 28, fill: COL.irr, weight: 600 });+ text(p, 'never repeats', SX, 468, m('ring', 2.6), { size: 28, fill: COL.irr, weight: 600 });+ fly(['π'], 'irr', [SX + 14, 260], [1060, 456], m('sep'));+ fly([R(2)], 'irr', [SX + 22, 340], [1060, 540], m('sep', .5));+ glow('irr', m('sep', 1.6));+ text(p, 'A few digits are not proof:', SX, 560, m('proof'), { size: 22, fill: COL.dim });+ text(p, 'π and √2 were proved', SX, 592, m('proof', .3), { size: 22, fill: COL.dim });+ text(p, 'irrational by mathematicians.', SX, 624, m('proof', .6), { size: 22, fill: COL.dim });+ }],+ ['real', 'Real numbers', (m) => {+ const p = panel(0);+ ringIn('real', m('ring'));+ note(p, 'Real numbers', 'real', ['rational + irrational:', 'every number on', 'the number line'], m('ring', .6));+ pulse(S.n['−2'], m('ex'), 1.4);+ mline(p, ['−2 is'], SX, 470, m('ex'), COL.chalk, 34, 'start');+ [['int', 'an integer', 'int'], ['rat', 'rational', 'rat'], ['real', 'real', 'real']].forEach(([k, w, mk_], i) => {+ text(p, w, SX + 24, 516 + i * 40, m(mk_), { size: 30, fill: COL[k], weight: 600 });+ glow(k, m(mk_));+ });+ glowRun('nat', m('nest', .2));+ }],+ ['q2', 'Quick check', () => { panel(0); hide(S.vnums, 0, .4); }, { ask: done => quiz(SORT_SCREEN, [{+ id: 'c-sort', prompt: ['Put each number in its ', h('b', '', 'smallest'), ' ring.'],+ build: sorter([+ [['46'], 'nat', '46 is a counting number: Natural.'],+ [['0'], 'whole', '0 is whole but not natural (counting starts at 1).'],+ [['−12'], 'int', '−12 is a negative whole step: Integers.'],+ [['6.675'], 'rat', '6.675 ends, so it is a fraction (6675/1000): Rational.'],+ [[F(2, 3)], 'rat', '2/3 is one integer over another: Rational.'],+ [[R(5)], 'irr', '√5 = 2.2360679… never ends and never repeats: Irrational.'],+ ], i => [140 + i * 190, 44]),+ }], done) }],+ ['line', 'The number line', (m) => {+ const p = panel(0);+ hide(S.venn, 0, .5);+ numberLine(.4, -4, 4);+ dirArrow(p, X(-2.2), X(-3.8), 470, 'smaller', m('dir'));+ dirArrow(p, X(2.2), X(3.8), 470, 'larger', m('dir', 1.6));+ landDot(p, 2, m('two'), COL.task);+ text(p, '2 is right of 1 and 0', X(1), 544, m('two', 1), { size: 28, fill: COL.task, anchor: 'middle', weight: 600 });+ landDot(p, -3, m('three'), COL.task);+ text(p, '−3 is left of −2 and −1', X(-2), 544, m('three', 1), { size: 28, fill: COL.task, anchor: 'middle', weight: 600 });+ }],+ ['place', 'Rational numbers on the line', (m) => {+ const p = panel(0);+ const all = path(p, `M${X(-4.7)} ${Y0}H${X(4.7)}`, { stroke: COL.real, 'stroke-width': 9, opacity: .55 }, { d: 0 }); // under the dots+ const sub = G(p, { o: 0 }); // quarter steps: room between the integers+ for (let v = -4; v < 4; v += .25) if (v % 1) path(sub, `M${X(v)} ${Y0 - 6}V${Y0 + 6}`, { stroke: COL.faint, 'stroke-width': 2 });+ show(sub, m('f1'), .6);+ mark(p, -2.38, ['−2.38'], m('a'));+ mark(p, -.75, ['−', F(3, 4)], m('b'));+ mark(p, .5, [F(1, 2)], m('c'));+ mark(p, 2, [R(4)], m('d'));+ mline(p, ['= 2'], X(2) + 34, Y0 - 102, m('d', 2.4), COL.task, 36, 'start');+ mark(p, 3.125, ['3', F(1, 8)], m('e'));+ mark(p, Math.SQRT2, [R(2), ' ≈ 1.41…'], m('irr', 1.2), COL.irr, true);+ draw(all, m('all'), 1.4);+ text(p, 'The real numbers fill the whole line.', 800, 812, m('all', .6), { size: 32, fill: COL.real, anchor: 'middle', weight: 600 });+ }],+ ['q3', 'Quick check', () => { panel(0); }, { ask: done => quiz(BAND, [+ { id: 'c-half', prompt: ['Tap the point at ', $m('−', F(1, 2)), '.'],+ build: tapDots([-1.5, -.5, .5, 1.5], -.5, 'Half a step left of 0.',+ v => v === .5 ? 'That one is positive one half. Negative numbers sit left of 0.'+ : v === -1.5 ? ['That is ', $m('−1', F(1, 2)), ': one and a half steps left of 0.'] : ['That is ', $m('1', F(1, 2)), ', to the right of 0.'],+ () => floatText('−1/2', X(-.5), Y0 - 40, COL.good)) },+ { id: 'c-greater', prompt: ['Tap the ', h('b', '', 'greater'), ' number: ', $m('−3'), ' or ', $m('−1'), '.'],+ build: tapDots([-3, -1], -1, '−1 is farther right, so it is greater.',+ () => '−3 is farther left, so it is the smaller one. Greater means farther right.',+ () => floatText('greater: farther right', X(-1), Y0 - 40, COL.good)) },+ ], done) }],+ ['wrap', 'Summary', (m) => {+ const p = panel(0);+ hide(S.line, 0, .4);+ [['Each family adds numbers: 0, then negatives, then fractions.', 'w1'],+ ['Rational: one integer over another. Its decimal ends or repeats.', 'w2'],+ ['Irrational: never ends, never repeats. Together they make the reals.', 'w3'],+ ['On a number line, smaller is left and larger is right.', 'w4']].forEach(([str, mk_], i) => {+ const g = G(p, { x: -16, y: 250 + i * 130, o: 0 });+ mk('circle', { cx: 200, cy: -12, r: 26, fill: COL.task }, g);+ T(g, String(i + 1), { x: 200, y: -1, size: 30, fill: COL.board, weight: 700, anchor: 'middle' });+ T(g, str, { x: 260, size: 34, weight: 600 });+ tw(g, { o: 1, x: 0 }, m(mk_), .6);+ });+ }],+ ['final1', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{+ id: 'p-classify1', prompt: ['Pick every family each number belongs to.'],+ build: grid(PRACTICE1, FAM_COLS),+ }], done, 'Chapter practice 1 of 3') }],+ ['final2', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{+ id: 'p-classify2', prompt: ['Pick every family each number belongs to. In ', $m('0.1010010001…'), ' each run of zeros is one longer.'],+ build: grid(PRACTICE2, FAM_COLS),+ }], done, 'Chapter practice 2 of 3') }],+ ['final3', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{+ id: 'p-side', prompt: ['Is each number left or right of 0 on a number line?'],+ build: grid(PRACTICE3, [['l', 'Left of 0', COL.nat, 'L'], ['r', 'Right of 0', COL.whole, 'R']], { multi: false }),+ }], done, 'Chapter practice 3 of 3') }],+ ['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],+].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));++/* ---------- practice data ---------- */+const PRACTICE1 = [+ { parts: ['−3'], ans: ['int', 'rat', 'real'], why: ['A negative whole step: an integer, so also rational (', $m(F('−3', 1)), ') and real.'] },+ { parts: ['4.', OV('5')], ans: ['rat', 'real'], why: ['4.555… repeats, so it is a fraction (', $m(F(41, 9)), '): rational and real.'] },+ { parts: ['1'], ans: ['nat', 'whole', 'int', 'rat', 'real'], why: '1 is a counting number, so it is in every ring around Natural: natural, whole, integer, rational, real.' },+ { parts: ['−', F(9, 3)], ans: ['int', 'rat', 'real'], why: [$m('−', F(9, 3), ' = −3'), ', an integer, so also rational and real.'] },+];+const PRACTICE2 = [+ { parts: ['−9.7654321'], ans: ['rat', 'real'], why: 'The decimal ends, so it is a fraction (−97654321/10000000): rational and real.' },+ { parts: [R(2)], ans: ['irr', 'real'], why: [$m(R(2), ' = 1.414213…'), ' never ends and never repeats: irrational and real.'] },+ { parts: ['5.', OV('678')], ans: ['rat', 'real'], why: 'The bar means 678 repeats forever, so it is rational (and real).' },+ { parts: ['0.1010010001…'], ans: ['irr', 'real'], why: 'The runs of zeros keep growing, so no block of digits ever repeats: irrational and real.' },+];+const PRACTICE3 = [+ { parts: [F(1, 45)], ans: ['r'], why: [$m(F(1, 45)), ' is tiny, but positive: right of 0.'] },+ { parts: ['−0.001'], ans: ['l'], why: 'Every negative number is left of 0, however close it is.' },+ { parts: ['−3', F(1, 8)], ans: ['l'], why: ['Negative: left of 0, just past −3.'] },+ { parts: [R(2)], ans: ['r'], why: [$m(R(2), ' ≈ 1.41'), ' is positive: right of 0.'] },+];+boot();+</script>+</body>+</html>diff --git a/site/math-notebook/ch02/audio/en/final1.mp3 b/site/math-notebook/ch02/audio/en/final1.mp3new file mode 100644index 0000000..d23203dBinary files /dev/null and b/site/math-notebook/ch02/audio/en/final1.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/final2.mp3 b/site/math-notebook/ch02/audio/en/final2.mp3new file mode 100644index 0000000..edbbcfcBinary files /dev/null and b/site/math-notebook/ch02/audio/en/final2.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/final3.mp3 b/site/math-notebook/ch02/audio/en/final3.mp3new file mode 100644index 0000000..799584dBinary files /dev/null and b/site/math-notebook/ch02/audio/en/final3.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/finish.mp3 b/site/math-notebook/ch02/audio/en/finish.mp3new file mode 100644index 0000000..b6e196fBinary files /dev/null and b/site/math-notebook/ch02/audio/en/finish.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/intro.mp3 b/site/math-notebook/ch02/audio/en/intro.mp3new file mode 100644index 0000000..57aeb77Binary files /dev/null and b/site/math-notebook/ch02/audio/en/intro.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/oppopp.mp3 b/site/math-notebook/ch02/audio/en/oppopp.mp3new file mode 100644index 0000000..2336fdfBinary files /dev/null and b/site/math-notebook/ch02/audio/en/oppopp.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/opposites.mp3 b/site/math-notebook/ch02/audio/en/opposites.mp3new file mode 100644index 0000000..4fb542fBinary files /dev/null and b/site/math-notebook/ch02/audio/en/opposites.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/owe.mp3 b/site/math-notebook/ch02/audio/en/owe.mp3new file mode 100644index 0000000..db223a4Binary files /dev/null and b/site/math-notebook/ch02/audio/en/owe.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/q1.mp3 b/site/math-notebook/ch02/audio/en/q1.mp3new file mode 100644index 0000000..4aae0cdBinary files /dev/null and b/site/math-notebook/ch02/audio/en/q1.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/q2.mp3 b/site/math-notebook/ch02/audio/en/q2.mp3new file mode 100644index 0000000..2e52505Binary files /dev/null and b/site/math-notebook/ch02/audio/en/q2.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/q3.mp3 b/site/math-notebook/ch02/audio/en/q3.mp3new file mode 100644index 0000000..8701536Binary files /dev/null and b/site/math-notebook/ch02/audio/en/q3.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/sides.mp3 b/site/math-notebook/ch02/audio/en/sides.mp3new file mode 100644index 0000000..ddf4ab4Binary files /dev/null and b/site/math-notebook/ch02/audio/en/sides.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/signs.mp3 b/site/math-notebook/ch02/audio/en/signs.mp3new file mode 100644index 0000000..2203917Binary files /dev/null and b/site/math-notebook/ch02/audio/en/signs.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/timings.js b/site/math-notebook/ch02/audio/en/timings.jsnew file mode 100644index 0000000..0933279--- /dev/null+++ b/site/math-notebook/ch02/audio/en/timings.js@@ -0,0 +1,492 @@+window.TIMINGS = {+ "intro": {+ "dur": 8.52,+ "marks": {+ "sub": 3.411+ },+ "cues": [+ [+ 0.104,+ "Chapter two."+ ],+ [+ 1.211,+ "Positive and negative numbers."+ ],+ [+ 3.411,+ "Every number except zero sits on one side of zero or the other."+ ]+ ]+ },+ "sides": {+ "dur": 24.0,+ "marks": {+ "zero": 4.245,+ "pos": 10.625,+ "neg": 16.576,+ "mirror": 20.365+ },+ "cues": [+ [+ 0.117,+ "Here's the number line again, this time from negative eight to eight."+ ],+ [+ 4.245,+ "Zero sits right in the middle."+ ],+ [+ 6.159,+ "Zero is neither positive nor negative."+ ],+ [+ 9.193,+ "It's the dividing point."+ ],+ [+ 10.625,+ "Numbers greater than zero are positive."+ ],+ [+ 13.438,+ "On a number line, they're to the right of zero."+ ],+ [+ 16.576,+ "Numbers less than zero are negative."+ ],+ [+ 19.219,+ "They're to the left."+ ],+ [+ 20.365,+ "The two sides mirror each other, with zero in between."+ ]+ ]+ },+ "signs": {+ "dur": 29.448,+ "marks": {+ "plus": 2.578,+ "same": 6.289,+ "minus": 9.297,+ "need": 13.893,+ "ends": 16.914,+ "inf": 19.023,+ "ninf": 23.242,+ "word": 25.794+ },+ "cues": [+ [+ 0.104,+ "How can you tell them apart when they're written down?"+ ],+ [+ 2.578,+ "A positive number can have a plus sign, but it doesn't need one."+ ],+ [+ 6.289,+ "Plus four and four mean exactly the same thing."+ ],+ [+ 9.297,+ "A negative number always has a minus sign in front: negative four."+ ],+ [+ 13.893,+ "Leave that sign off, and you've written a different number."+ ],+ [+ 16.914,+ "Now look at the arrows on the ends."+ ],+ [+ 19.023,+ "They mean the numbers keep going forever: to infinity on the right, and to negative infinity on the left."+ ],+ [+ 25.794,+ "Infinity means endless, without any limit."+ ]+ ]+ },+ "q1": {+ "dur": 4.656,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.146,+ "Is each number positive, negative, or neither?"+ ]+ ]+ },+ "world": {+ "dur": 35.352,+ "marks": {+ "use": 2.305,+ "r1": 5.417,+ "r2": 11.393,+ "r3": 16.693,+ "r4": 21.055,+ "r5": 25.911,+ "pair": 28.932+ },+ "cues": [+ [+ 0.104,+ "Why do we need negative numbers at all?"+ ],+ [+ 2.305,+ "Because lots of things in the world come in opposite pairs."+ ],+ [+ 5.417,+ "Money you owe, a debt, is negative."+ ],+ [+ 8.047,+ "Money you keep, your savings, is positive."+ ],+ [+ 11.393,+ "Temperatures below zero are negative."+ ],+ [+ 14.427,+ "Above zero, positive."+ ],+ [+ 16.693,+ "Below sea level is negative."+ ],+ [+ 18.841,+ "Above sea level is positive."+ ],+ [+ 21.055,+ "Money taken out of a bank account is negative."+ ],+ [+ 24.245,+ "Money put in is positive."+ ],+ [+ 25.911,+ "Even electric charges come in negative and positive."+ ],+ [+ 28.932,+ "In every pair, zero is the starting point, and the two sides go in opposite directions."+ ]+ ]+ },+ "owe": {+ "dur": 17.856,+ "marks": {+ "story": 1.159,+ "coins": 4.245,+ "owes": 6.302,+ "neg": 11.003,+ "pos": 12.396+ },+ "cues": [+ [+ 0.104,+ "Let's try one."+ ],+ [+ 1.159,+ "Devin borrows two dollars from his friend Stanley."+ ],+ [+ 4.245,+ "Stanley hands over the money."+ ],+ [+ 6.302,+ "Now Devin owes two dollars."+ ],+ [+ 8.62,+ "Owing is a debt, so it's negative: negative two."+ ],+ [+ 12.396,+ "For Stanley, it's the other way around."+ ],+ [+ 14.935,+ "He is owed two dollars: positive two."+ ]+ ]+ },+ "q2": {+ "dur": 3.528,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.198,+ "Find each amount on the number line."+ ]+ ]+ },+ "vertical": {+ "dur": 32.136,+ "marks": {+ "up": 2.76,+ "warm": 5.234,+ "drop": 9.766,+ "cold": 12.904,+ "sea": 14.401,+ "gull": 17.956,+ "sub": 21.849,+ "rule": 25.612+ },+ "cues": [+ [+ 0.091,+ "A number line doesn't have to lie flat."+ ],+ [+ 2.76,+ "Stand it up, and you get a thermometer."+ ],+ [+ 5.234,+ "On a warm day it might be twenty degrees: positive twenty."+ ],+ [+ 9.766,+ "When the temperature falls to ten degrees below zero, that's negative ten."+ ],+ [+ 14.401,+ "Heights work the same way, with sea level as zero."+ ],+ [+ 17.956,+ "A gull thirty feet above the water is at positive thirty."+ ],+ [+ 21.849,+ "A submarine thirty feet below is at negative thirty."+ ],+ [+ 25.612,+ "On an upright number line, above zero is positive, and below zero is negative."+ ]+ ]+ },+ "opposites": {+ "dur": 25.608,+ "marks": {+ "five": 2.526,+ "nfive": 4.987,+ "opp": 8.151,+ "flip": 14.062,+ "eight": 17.448,+ "zero": 21.198+ },+ "cues": [+ [+ 0.091,+ "Look at five and negative five."+ ],+ [+ 2.526,+ "Five is five steps to the right of zero."+ ],+ [+ 4.987,+ "Negative five is five steps to the left."+ ],+ [+ 8.151,+ "Same distance from zero, opposite sides."+ ],+ [+ 11.354,+ "Numbers like these are called opposites."+ ],+ [+ 14.062,+ "To find a number's opposite, flip it across zero."+ ],+ [+ 17.448,+ "What's the opposite of eight?"+ ],+ [+ 19.036,+ "Flip it: negative eight."+ ],+ [+ 21.198,+ "And zero is its own opposite, because flipping doesn't move it."+ ]+ ]+ },+ "oppopp": {+ "dur": 19.032,+ "marks": {+ "start": 1.589,+ "first": 3.438,+ "second": 5.326,+ "rule": 9.505,+ "home": 16.771+ },+ "cues": [+ [+ 0.104,+ "Now flip twice."+ ],+ [+ 1.589,+ "Start with negative six."+ ],+ [+ 3.438,+ "Its opposite is six."+ ],+ [+ 5.326,+ "Now take the opposite of six, and you're back at negative six."+ ],+ [+ 9.505,+ "This is the opposites of opposites property."+ ],+ [+ 12.591,+ "The opposite of the opposite of a number is the number itself."+ ],+ [+ 16.771,+ "Two flips always bring you home."+ ]+ ]+ },+ "q3": {+ "dur": 2.736,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.133,+ "Flip across zero."+ ]+ ]+ },+ "wrap": {+ "dur": 30.096,+ "marks": {+ "w1": 1.003,+ "w2": 7.865,+ "w3": 13.086,+ "w4": 20.273,+ "end": 28.06+ },+ "cues": [+ [+ 0.104,+ "To sum up."+ ],+ [+ 1.003,+ "Positive numbers are greater than zero, negative numbers are less than zero, and zero is neither."+ ],+ [+ 7.865,+ "A negative number always shows its minus sign."+ ],+ [+ 10.938,+ "A plus sign is optional."+ ],+ [+ 13.086,+ "Opposite quantities, like owing and saving, or below and above, get opposite signs."+ ],+ [+ 20.273,+ "Opposites are the same distance from zero, on opposite sides."+ ],+ [+ 24.388,+ "And the opposite of the opposite is the number itself."+ ],+ [+ 28.06,+ "Now try the chapter practice."+ ]+ ]+ },+ "final1": {+ "dur": 3.864,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Chapter practice."+ ],+ [+ 1.497,+ "Write the integer for each quantity."+ ]+ ]+ },+ "final2": {+ "dur": 2.016,+ "marks": {},+ "cues": [+ [+ 0.091,+ "Now find the opposites."+ ]+ ]+ },+ "final3": {+ "dur": 2.616,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Last one."+ ],+ [+ 1.159,+ "True or false?"+ ]+ ]+ },+ "finish": {+ "dur": 2.832,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Great job."+ ],+ [+ 1.159,+ "That's the end of chapter two."+ ]+ ]+ }+};diff --git a/site/math-notebook/ch02/audio/en/vertical.mp3 b/site/math-notebook/ch02/audio/en/vertical.mp3new file mode 100644index 0000000..5a44244Binary files /dev/null and b/site/math-notebook/ch02/audio/en/vertical.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/world.mp3 b/site/math-notebook/ch02/audio/en/world.mp3new file mode 100644index 0000000..fec54dbBinary files /dev/null and b/site/math-notebook/ch02/audio/en/world.mp3 differdiff --git a/site/math-notebook/ch02/audio/en/wrap.mp3 b/site/math-notebook/ch02/audio/en/wrap.mp3new file mode 100644index 0000000..449bfdcBinary files /dev/null and b/site/math-notebook/ch02/audio/en/wrap.mp3 differdiff --git a/site/math-notebook/ch02/index.html b/site/math-notebook/ch02/index.htmlnew file mode 100644index 0000000..b69a913--- /dev/null+++ b/site/math-notebook/ch02/index.html@@ -0,0 +1,359 @@+<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<title>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 -->+<style>+ .screen .grid.text .row { grid-template-columns: minmax(0, 1fr) auto 40px; }+ .screen .grid.text .why { padding-left: 0; }+ .side .grid .row { grid-template-columns: 80px minmax(0, 1fr) 34px; }+ .side .grid .why { padding-left: 96px; }+ .blanks .say { display: inline-block; width: 880px; font-size: 30px; vertical-align: middle; }+</style>+</head>+<body>+<script src="../lib/engine.js"></script>+<script src="audio/en/timings.js"></script>+<script>+'use strict';+const CHAPTER = { number: 2, title: 'Positive and Negative Numbers', minutes: 8, language: 'en', next: '../ch03/' };+AXIS.u = 80; // number line −8…8 across the stage++/* ---------- chapter drawing helpers ---------- */+const mline = (p, parts, x, y, t0, fill = COL.chalk, size = 48, anchor = 'middle') => { const e = M(p, [].concat(parts), { x, y, size, fill, anchor, o: 0 }); show(e, t0); return e; };+const text = (p, str, x, y, t0, { size = 30, fill = COL.chalk, anchor = 'start', weight = 500, font = UI } = {}) => { const e = T(p, str, { x, y, size, fill, anchor, weight, font, o: 0 }); show(e, t0); return e; };+// Sign colour: positive blue, negative coral, zero chalk (engine POS / NEG).+const pnCol = v => v > 0 ? POS : v < 0 ? NEG : COL.chalk;+// One side of the number line tinted in its sign colour, kept under the ticks (lives in S.line).+function pnBand(v0, v1, col, t0) {+ const b = path(S.line, `M${X(v0)} ${Y0}H${X(v1)}`, { stroke: col, 'stroke-width': 12, opacity: .45, 'stroke-linecap': 'butt' }, { d: 0 });+ S.line.insertBefore(b, S.line.firstChild);+ draw(b, t0, 1.1);+ return b;+}+// n unit hops from 0 in direction dir (+1 right, −1 left), one arc per step.+function pnHops(p, n, dir, t0, col, step = .28) {+ for (let k = 0; k < n; k++) {+ const a = X(dir * k), b = X(dir * (k + 1));+ draw(path(p, `M${a} ${Y0 - 14}Q${(a + b) / 2} ${Y0 - 72} ${b} ${Y0 - 14}`, { stroke: col, 'stroke-width': 3 }, { d: 0 }), t0 + k * step, step, lin);+ }+}+// Flip a dot across zero from a to b along an arc whose top is at y = peak; the dot changes to b's sign colour.+// Pass g to move an existing dot (from landDot or an earlier flip); returns the dot.+function pnFlip(p, a, b, t0, { peak = 420, dur = 1.5, g } = {}) {+ const x1 = X(a), x2 = X(b), cx = (x1 + x2) / 2, cy = 2 * peak - Y0;+ draw(path(p, `M${x1} ${Y0}Q${cx} ${cy} ${x2} ${Y0}`, { stroke: COL.task, 'stroke-width': 3, opacity: .85 }, { d: 0 }), t0, dur, io);+ if (!g) {+ g = G(p, { x: x1, y: Y0, o: 0 });+ mk('circle', { r: 12, fill: pnCol(a), stroke: COL.board, 'stroke-width': 2 }, g);+ show(g, t0, .15);+ }+ prog(q => { const u = 1 - q; put(g, { x: u * u * x1 + 2 * u * q * cx + q * q * x2, y: u * u * Y0 + 2 * u * q * cy + q * q * Y0 }); }, t0, dur, io);+ tw(g.firstChild, { c_fill: pnCol(b) }, t0 + dur * .45, .2, lin);+ return g;+}+// A labelled point on the number line: dot, leader, label above.+function mark(p, v, label, t0, col = pnCol(v)) {+ const x = X(v);+ const g = landDot(p, v, t0, col);+ draw(path(p, `M${x} ${Y0 - 18}V${Y0 - 64}`, { stroke: col, 'stroke-width': 3 }, { d: 0 }), t0 + .2, .3);+ return [g, mline(p, label, x, Y0 - 102, t0 + .35, col, 40)];+}+// Arrowhead over one end of the number line (d = +1 right, −1 left).+const pnTip = (p, d, col) => path(p, `M${X(8.7 * d) - 15 * d} ${Y0 - 10}L${X(8.7 * d)} ${Y0}L${X(8.7 * d) - 15 * d} ${Y0 + 10}`, { stroke: col, 'stroke-width': 6 }, { o: 0 });+// Straight arrow with a head, drawn on.+function pnArrow(p, x1, y1, x2, y2, col, t0, dur = .6) {+ const a = Math.atan2(y2 - y1, x2 - x1), hx = c => x2 - 16 * Math.cos(a + c), hy = c => y2 - 16 * Math.sin(a + c);+ draw(path(p, `M${x1} ${y1}L${x2} ${y2}M${hx(.5)} ${hy(.5)}L${x2} ${y2}L${hx(-.5)} ${hy(-.5)}`, { stroke: col, 'stroke-width': 4 }, { d: 0 }), t0, dur);+}+// A one-dollar coin.+function pnCoin(p, x, y) {+ const g = G(p, { x, y, o: 0 });+ mk('circle', { r: 28, fill: mix(COL.board, COL.int, .25), stroke: COL.int, 'stroke-width': 3 }, g);+ T(g, '$1', { y: 8, size: 22, fill: COL.int, weight: 700, anchor: 'middle' });+ return g;+}+// A dot (in its sign colour) and its label pop onto the line as an answer effect.+function pnDotFx(v, label) {+ const L = S.q || qlayer();+ const g = G(L, { x: X(v), y: Y0, s: 0, o: 0 });+ mk('circle', { r: 12, fill: pnCol(v), stroke: COL.board, 'stroke-width': 2 }, g);+ fx(g, { s: 1, o: 1 }, 0, .45, back);+ fx(M(L, [label], { x: X(v), y: Y0 - 36, size: 34, fill: pnCol(v), o: 0 }), { o: 1 }, .25, .4);+}+// Tap points on the line, with visible dots at the candidates (from ch01).+const tapDots = (vals, ...rest) => (body, api) => {+ const ctl = tap(vals, ...rest)(body, api);+ for (const v of vals) {+ const g = landDot(S.q, v, 0, COL.task, fx);+ g.style.pointerEvents = 'none';+ S.dots[v] = g;+ }+ return ctl;+};+// blanks with a sentence before each box (rows: { say: rich text, parts: [{ box }], why, hint }).+// A leading + and thousands commas are accepted: "+1,250" is read as 1250.+const pnBlanks = rows => (body, api) => {+ const ctl = blanks(rows.map(({ say, ...r }) => r))(body, api);+ body.querySelectorAll('.bline').forEach((ln, i) => ln.prepend(h('span', 'say', [rich(rows[i].say, 30)])));+ const check = ctl.check;+ ctl.check = () => {+ body.querySelectorAll('input.box').forEach(b => { b.value = b.value.replace(/^\s*\+\s*/, '').replace(/(\d),(?=\d{3}\b)/g, '$1'); });+ check();+ };+ return ctl;+};+const SIGN_COLS = [['p', 'Positive', POS, 'P'], ['n', 'Negative', NEG, 'N'], ['z', 'Neither', COL.chalk, '0']];+const Q1POS = { x: 800, y: 50, w: 780, cls: 'side', maxH: 500 }; // above the line, wide enough for three answer buttons+const WORLD = [+ ['debt (money you owe)', 'savings (money you keep)', 'r1'],+ ['temperature below zero', 'temperature above zero', 'r2'],+ ['below sea level', 'above sea level', 'r3'],+ ['debit (money taken out)', 'credit (money put in)', 'r4'],+ ['negative electric charge', 'positive electric charge', 'r5'],+];++/* ---------- beats: [id, title, run(m, D), { ask }?] ---------- */+const BEATS = [+ ['intro', 'Positive and negative numbers', (m, D) => {+ const g = G(scene, { o: 0, y: 24 });+ T(g, 'Unit 1 · The Number System · Chapter 2', { x: 800, y: 300, size: 28, fill: COL.dim, anchor: 'middle' });+ T(g, 'Positive and', { x: 800, y: 410, size: 84, weight: 600, anchor: 'middle' });+ T(g, 'Negative Numbers', { x: 800, y: 510, size: 84, weight: 600, anchor: 'middle' });+ tw(g, { o: 1, y: 0 }, .2, 1.1, out);+ const mini = G(scene, { o: 0 }); // a tiny number line: coral left, 0, blue right+ path(mini, 'M620 590H784', { stroke: NEG, 'stroke-width': 8 });+ path(mini, 'M816 590H980', { stroke: POS, 'stroke-width': 8 });+ mk('circle', { cx: 800, cy: 590, r: 9, fill: COL.chalk }, mini);+ T(mini, '−', { x: 596, y: 603, size: 44, fill: NEG, anchor: 'middle', font: MATH });+ T(mini, '+', { x: 1004, y: 603, size: 44, fill: POS, anchor: 'middle', font: MATH });+ show(mini, .9, .8);+ const r = text(scene, 'Every number except 0 sits on one side of zero.', 800, 690, m('sub'), { size: 34, fill: COL.dim, anchor: 'middle' });+ tw(g, { o: 0, y: -24 }, D - .9, .8); hide(r, D - .9, .8); hide(mini, D - .9, .8);+ }],+ ['sides', 'Two sides of zero', (m) => {+ const p = panel(0);+ numberLine(.3, -8, 8);+ const z = landDot(p, 0, m('zero'), COL.chalk);+ pulse(z, m('zero', .6), 1.6);+ text(p, '0 is neither positive nor negative', 800, 740, m('zero', 2), { size: 30, anchor: 'middle', weight: 600 });+ pnBand(.15, 8.55, POS, m('pos'));+ const lp = text(p, 'positive', X(4.3), 470, m('pos', .6), { size: 46, fill: POS, anchor: 'middle', weight: 700 });+ text(p, 'greater than 0', X(4.3), 514, m('pos', 1.2), { size: 28, fill: COL.dim, anchor: 'middle' });+ pnBand(-.15, -8.55, NEG, m('neg'));+ const ln = text(p, 'negative', X(-4.3), 470, m('neg', .6), { size: 46, fill: NEG, anchor: 'middle', weight: 700 });+ text(p, 'less than 0', X(-4.3), 514, m('neg', 1.2), { size: 28, fill: COL.dim, anchor: 'middle' });+ pulse(lp, m('mirror'), 1.2); pulse(ln, m('mirror'), 1.2);+ for (const [v, k] of [[2, 0], [5, 1]]) { landDot(p, v, m('mirror', .8 + k * .6), POS); landDot(p, -v, m('mirror', .8 + k * .6), NEG); }+ }],+ ['signs', 'Writing the signs', (m) => {+ const p = panel(0);+ const [d4] = mark(p, 4, ['+4'], .3);+ mline(p, ['+4 = 4'], X(4), 330, m('same'), POS, 60);+ text(p, 'the + sign is optional', X(4), 384, m('same', 1), { size: 28, fill: COL.dim, anchor: 'middle' });+ mark(p, -4, ['−4'], m('minus'));+ mline(p, ['−4'], X(-4), 330, m('minus', .8), NEG, 60);+ text(p, 'the − sign is required', X(-4), 384, m('need'), { size: 28, fill: COL.dim, anchor: 'middle' });+ pulse(d4, m('need', 1.8), 1.8);+ const tr = pnTip(p, 1, COL.task), tl = pnTip(p, -1, COL.task);+ show(tr, m('ends'), .3); show(tl, m('ends'), .3);+ hide(tr, m('inf', 1.2), .5); hide(tl, m('ninf', 1.2), .5);+ text(p, '∞', 1550, Y0 + 18, m('inf'), { size: 60, fill: POS, anchor: 'middle', font: MATH });+ text(p, 'infinity', 1540, 690, m('inf', .4), { size: 22, fill: POS, anchor: 'middle', weight: 600 });+ text(p, '−∞', 50, Y0 + 18, m('ninf'), { size: 52, fill: NEG, anchor: 'middle', font: MATH });+ text(p, 'negative', 60, 690, m('ninf', .4), { size: 22, fill: NEG, anchor: 'middle', weight: 600 });+ text(p, 'infinity', 60, 716, m('ninf', .4), { size: 22, fill: NEG, anchor: 'middle', weight: 600 });+ text(p, 'Infinity (∞): endless, without any limit', 800, 790, m('word'), { size: 30, fill: COL.dim, anchor: 'middle' });+ }],+ ['q1', 'Quick check', () => { panel(0); }, { ask: done => quiz(Q1POS, [{+ id: 'c-sign', prompt: ['Is each number positive, negative, or neither?'],+ build: grid([+ { parts: ['−6'], ans: ['n'], why: 'It has a minus sign: negative, left of 0.', fx: () => pnDotFx(-6, '−6') },+ { parts: ['+3'], ans: ['p'], why: '+3 is the same as 3: positive, right of 0.', fx: () => pnDotFx(3, '+3') },+ { parts: ['0'], ans: ['z'], why: '0 is the dividing point: neither positive nor negative.', fx: () => pnDotFx(0, '0') },+ { parts: ['−1.5'], ans: ['n'], why: 'A decimal can be negative too: −1.5 is less than 0.', fx: () => pnDotFx(-1.5, '−1.5') },+ ], SIGN_COLS, { multi: false }),+ }], done) }],+ ['world', 'Opposite quantities', (m) => {+ const p = panel(0);+ draw(path(p, 'M800 150V500', { stroke: COL.dim, 'stroke-width': 2.5 }, { d: 0 }), .3, .6);+ text(p, '− negative', 770, 130, .4, { size: 34, fill: NEG, anchor: 'end', weight: 700 });+ text(p, 'positive +', 830, 130, .4, { size: 34, fill: POS, weight: 700 });+ WORLD.forEach(([l, r, k], i) => {+ const y = 202 + i * 62;+ tw(T(p, l, { x: 840, y, size: 30, fill: COL.chalk, anchor: 'end', o: 0 }), { o: 1, x: 770 }, m(k), .7, out);+ tw(T(p, r, { x: 760, y, size: 30, fill: COL.chalk, o: 0 }), { o: 1, x: 830 }, m(k, i === 4 ? .6 : 2.4), .7, out);+ });+ pnArrow(p, 770, 540, 470, 540, NEG, m('pair', .5));+ pnArrow(p, 830, 540, 1130, 540, POS, m('pair', .5));+ }],+ ['owe', 'Owing is negative', (m) => {+ const p = panel(0);+ text(p, 'Devin borrows $2 from his friend Stanley.', 800, 170, .3, { size: 38, anchor: 'middle', weight: 600 });+ text(p, 'Devin', 470, 300, m('story', .6), { size: 34, anchor: 'middle', weight: 700 });+ text(p, 'Stanley', 1130, 300, m('story', 1.2), { size: 34, anchor: 'middle', weight: 700 });+ const c1 = pnCoin(p, 1100, 370), c2 = pnCoin(p, 1164, 370);+ show(c1, m('story', 1.6)); show(c2, m('story', 1.8));+ tw(c1, { x: 438 }, m('coins'), 1.3); tw(c2, { x: 502 }, m('coins', .15), 1.3);+ text(p, 'owes $2: a debt', 470, 450, m('owes', .4), { size: 30, fill: NEG, anchor: 'middle', weight: 600 });+ move(p, 0, -2, 535, m('neg'));+ landDot(p, -2, m('neg', .7), NEG);+ text(p, 'is owed $2', 1130, 450, m('pos', 1.8), { size: 30, fill: POS, anchor: 'middle', weight: 600 });+ move(p, 0, 2, 535, m('pos', 3.2));+ landDot(p, 2, m('pos', 3.9), POS);+ }],+ ['q2', 'Quick check', () => { panel(0); }, { ask: done => quiz(BAND, [+ { id: 'c-owe', prompt: ['Ana owes her sister $3. Tap the integer for Ana’s money.'],+ build: tapDots([-4, -3, 3, 4], -3, 'Owing $3 is a debt: −3, three steps left of 0.',+ v => v === 3 ? 'Right distance, wrong side. Owing is a debt, so the integer is negative.'+ : v === 4 ? 'That is 4, and it is positive. Owing $3 is negative, 3 steps from 0.' : 'That is −4, four steps left. Ana owes $3, so count 3 steps.',+ () => floatText('owes $3 → −3', X(-3), Y0 - 40, COL.good)) },+ { id: 'c-credit', prompt: ['Ben puts $5 into his bank account. Tap the integer.'],+ build: tapDots([-6, -5, 5, 6], 5, 'Money put in is a credit: +5, or just 5.',+ v => v === -5 ? 'Right distance, wrong side. Money put in is positive.'+ : v === 6 ? 'That is 6. Ben puts in $5, so count 5 steps.' : 'That is −6: negative, and 6 steps away. Money put in is positive.',+ () => floatText('puts in $5 → +5', X(5), Y0 - 40, COL.good)) },+ ], done) }],+ ['vertical', 'Upright number lines', (m) => {+ const p = panel(0);+ hide(S.line, 0, .4);+ const Z = 480; // y of zero on both scales+ const above = put(mk('rect', { x: 240, y: 170, width: 1220, height: Z - 170, fill: POS }, p), { o: 0 });+ tw(above, { o: .08 }, m('rule'), .6);+ const below = put(mk('rect', { x: 240, y: Z, width: 1220, height: 330, fill: NEG }, p), { o: 0 });+ tw(below, { o: .08 }, m('rule'), .6);+ const gT = G(p, { o: 0 });+ const th = thermometer(gT, { x: 430, bottom: 760, top: 200, lo: -30, hi: 30, step: 10, value: 20, color: COL.task });+ show(gT, .3, .6);+ text(p, '°C', 430, 160, .5, { size: 26, fill: COL.dim, anchor: 'middle' });+ mline(p, ['+20°'], 474, th.Yt(20) + 12, m('warm', .6), POS, 40, 'start');+ th.set(-10, m('drop'), tw, 2.4);+ mline(p, ['−10°'], 474, th.Yt(-10) + 12, m('cold'), NEG, 40, 'start');+ // sea level: a second upright scale, in feet+ const Yf = v => Z - v * 7;+ vAxis(p, { x: 1150, Yf, lo: -40, hi: 40, step: 10, t0: m('sea') });+ text(p, 'feet', 1150, 172, m('sea', .3), { size: 26, fill: COL.dim, anchor: 'middle' });+ const wave = path(p, `M1180 ${Z}q15 -10 30 0t30 0t30 0t30 0t30 0t30 0t30 0t30 0`, { stroke: COL.dim, 'stroke-width': 3 }, { d: 0 });+ draw(wave, m('sea', .6), .8);+ text(p, 'sea level', 1436, Z + 8, m('sea', 1), { size: 22, fill: COL.dim, weight: 600 });+ const gull = G(p, { x: 1300, y: Yf(30), o: 0 });+ path(gull, 'M-24 0Q-12 -14 0 0Q12 -14 24 0', { stroke: COL.chalk, 'stroke-width': 3.5 });+ show(gull, m('gull'));+ const dg = G(p, { x: 1150, y: Yf(30), s: 0, o: 0 }); mk('circle', { r: 10, fill: POS }, dg); pop(dg, m('gull', .4));+ text(p, '+30 ft', 1340, Yf(30) + 10, m('gull', .8), { size: 32, fill: POS, weight: 600 });+ const sub = G(p, { x: 1300, y: Yf(-30), o: 0 });+ mk('ellipse', { rx: 44, ry: 15, fill: COL.board, stroke: COL.chalk, 'stroke-width': 3 }, sub);+ mk('rect', { x: -10, y: -28, width: 22, height: 14, rx: 3, fill: COL.board, stroke: COL.chalk, 'stroke-width': 3 }, sub);+ path(sub, 'M4 -28V-40H14', { stroke: COL.chalk, 'stroke-width': 3 });+ show(sub, m('sub'));+ const ds = G(p, { x: 1150, y: Yf(-30), s: 0, o: 0 }); mk('circle', { r: 10, fill: NEG }, ds); pop(ds, m('sub', .4));+ text(p, '−30 ft', 1356, Yf(-30) + 10, m('sub', .8), { size: 32, fill: NEG, weight: 600 });+ draw(path(p, `M480 ${Z}H1050`, { stroke: COL.chalk, 'stroke-width': 2, opacity: .5 }, { d: 0 }), m('rule'), .8);+ pnArrow(p, 720, Z - 30, 720, 250, POS, m('rule', .4));+ text(p, 'above 0:', 750, 330, m('rule', .8), { size: 28, fill: COL.dim });+ text(p, 'positive', 750, 372, m('rule', .8), { size: 38, fill: POS, weight: 700 });+ pnArrow(p, 720, Z + 30, 720, 710, NEG, m('rule', 2.6));+ text(p, 'below 0:', 750, 600, m('rule', 3), { size: 28, fill: COL.dim });+ text(p, 'negative', 750, 642, m('rule', 3), { size: 38, fill: NEG, weight: 700 });+ }],+ ['opposites', 'Opposites', (m) => {+ const p = panel(0);+ show(S.line, .2, .5);+ landDot(p, 5, .4, POS); landDot(p, -5, .6, NEG);+ pnHops(p, 5, 1, m('five'), POS);+ text(p, '5 steps', X(2.5), Y0 - 88, m('five', 1.4), { size: 28, fill: POS, anchor: 'middle', weight: 600 });+ pnHops(p, 5, -1, m('nfive'), NEG);+ text(p, '5 steps', X(-2.5), Y0 - 88, m('nfive', 1.4), { size: 28, fill: NEG, anchor: 'middle', weight: 600 });+ text(p, 'Opposites: same distance from 0, opposite sides', 800, 250, m('opp'), { size: 36, anchor: 'middle', weight: 700 });+ text(p, '5 and −5 are opposites.', 800, 304, m('opp', 1.4), { size: 30, fill: COL.dim, anchor: 'middle' });+ pnFlip(p, 5, -5, m('flip', .3), { peak: 400 });+ landDot(p, 8, m('eight'), POS);+ pnFlip(p, 8, -8, m('eight', 1.6), { peak: 350, dur: 1.7 });+ text(p, 'the opposite of 8 is −8', 800, 750, m('eight', 2.6), { size: 32, anchor: 'middle', weight: 600 });+ const z = landDot(p, 0, m('zero'), COL.chalk);+ pulse(z, m('zero', 1.4), 1.7);+ text(p, 'the opposite of 0 is 0', 800, 800, m('zero', 1.2), { size: 32, fill: COL.dim, anchor: 'middle', weight: 600 });+ }],+ ['oppopp', 'Opposite of the opposite', (m) => {+ const p = panel(0);+ const d = landDot(p, -6, .4, NEG);+ const home = mk('circle', { cx: X(-6), cy: Y0, r: 24, fill: 'none', stroke: COL.task, 'stroke-width': 3 }, p);+ put(home, { o: 0 }); show(home, m('start'), .4);+ pnFlip(p, -6, 6, m('first'), { peak: 430, g: d });+ text(p, 'the opposite of −6 is 6', 800, 750, m('first', .8), { size: 32, anchor: 'middle', weight: 600 });+ pnFlip(p, 6, -6, m('second', .4), { peak: 340, g: d });+ text(p, 'the opposite of 6 is −6', 800, 800, m('second', 1.6), { size: 32, anchor: 'middle', weight: 600 });+ text(p, 'Opposites of opposites property', 800, 200, m('rule'), { size: 32, fill: COL.task, anchor: 'middle', weight: 700 });+ text(p, 'The opposite of the opposite of a number is the number itself.', 800, 256, m('rule', 1.2), { size: 34, anchor: 'middle', weight: 600 });+ pulse(d, m('home'), 1.8);+ tw(home, { 'a_stroke-width': 7 }, m('home'), .3, out); tw(home, { 'a_stroke-width': 3 }, m('home', .35), .5);+ }],+ ['q3', 'Quick check', () => { panel(0); }, { ask: done => quiz(BAND, [+ { id: 'c-opp3', prompt: ['Tap the opposite of ', $m('3'), '.'],+ build: tapDots([-4, -3, 3, 4], -3, 'Flip 3 across 0: −3, the same 3 steps on the other side.',+ v => v === 3 ? 'That is 3 itself. Its opposite is on the other side of 0.'+ : v === 4 ? 'That is 4, on the same side as 3. Flip across 0.' : 'That is −4: four steps from 0, but 3 is only three steps away.',+ () => floatText('opposite of 3 → −3', X(-3), Y0 - 40, COL.good)) },+ { id: 'c-oppopp', prompt: ['Tap the opposite of the opposite of ', $m('−7'), '.'],+ build: tapDots([-7, 7], -7, 'Flip twice and you are home: −7 → 7 → −7.',+ () => 'That is only one flip. The opposite of 7 is −7: flip once more.',+ () => floatText('back to −7', X(-7), Y0 - 40, COL.good)) },+ ], done) }],+ ['wrap', 'Summary', (m) => {+ const p = panel(0);+ hide(S.line, 0, .4);+ [['Positive: greater than 0. Negative: less than 0. 0 is neither.', 'w1'],+ ['A negative number always shows its − sign; the + is optional.', 'w2'],+ ['Opposite quantities get opposite signs: owe −2, save +2.', 'w3'],+ ['Opposites: same distance from 0. Flip twice to get back.', 'w4']].forEach(([str, mk_], i) => {+ const g = G(p, { x: -16, y: 250 + i * 130, o: 0 });+ mk('circle', { cx: 200, cy: -12, r: 26, fill: COL.task }, g);+ T(g, String(i + 1), { x: 200, y: -1, size: 30, fill: COL.board, weight: 700, anchor: 'middle' });+ T(g, str, { x: 260, size: 34, weight: 600 });+ tw(g, { o: 1, x: 0 }, m(mk_), .6);+ });+ }],+ ['final1', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{+ id: 'p-quantities', prompt: ['Write the integer for each quantity.'],+ build: pnBlanks(PRACTICE1),+ }], done, 'Chapter practice 1 of 3') }],+ ['final2', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{+ id: 'p-opposites', prompt: ['Find each number.'],+ build: pnBlanks(PRACTICE2),+ }], done, 'Chapter practice 2 of 3') }],+ ['final3', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{+ id: 'p-truefalse', prompt: ['True or false?'],+ build: grid(PRACTICE3, TF, { multi: false, text: true }),+ }], done, 'Chapter practice 3 of 3') }],+ ['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],+].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));++/* ---------- practice data ---------- */+const PRACTICE1 = [+ { say: 'A submarine is 250 feet below sea level.', parts: [{ box: '-250' }], why: 'Below sea level is negative: −250.', hint: 'Below sea level is negative.' },+ { say: 'A plane is 900 feet above the runway.', parts: [{ box: '900' }], why: 'Above is positive: 900 (or +900).', hint: 'Above is positive.' },+ { say: 'The temperature is 6 degrees below zero.', parts: [{ box: '-6' }], why: 'Below zero is negative: −6.', hint: 'Below zero means negative.' },+ { say: 'Rosa owes her brother $12.', parts: [{ box: '-12' }], why: 'Owing is a debt: −12.', hint: 'Money you owe is a debt: negative.' },+ { say: 'Kai has $340 in his savings account.', parts: [{ box: '340' }], why: 'Savings are positive: 340 (or +340).', hint: 'Money you keep is positive.' },+];+const PRACTICE2 = [+ { say: ['The opposite of ', $m('9')], parts: [{ box: '-9' }], why: 'Flip 9 across 0: −9.', hint: 'Same distance from 0, other side.' },+ { say: ['The opposite of ', $m('−100')], parts: [{ box: '100' }], why: 'Flip −100 across 0: 100.', hint: 'The opposite of a negative number is positive.' },+ { say: ['The opposite of the opposite of ', $m('58')], parts: [{ box: '58' }], why: '58 → −58 → 58: the number itself.', hint: 'Flip twice: where do you end up?' },+ { say: ['The opposite of the opposite of ', $m('−35')], parts: [{ box: '-35' }], why: '−35 → 35 → −35: the number itself.', hint: 'Two flips bring you home.' },+ { say: ['The opposite of ', $m('0')], parts: [{ box: '0' }], why: '0 does not move when you flip it: its opposite is 0.', hint: 'Flipping 0 across 0 leaves it where it is.' },+];+const PRACTICE3 = [+ { parts: [$m('+7'), ' and ', $m('7'), ' are the same number.'], ans: ['t'], why: 'The + sign is optional: +7 and 7 are the same.' },+ { parts: [$m('0'), ' is a positive number.'], ans: ['f'], why: '0 is neither positive nor negative.' },+ { parts: [$m('−3'), ' and ', $m('3'), ' are the same distance from 0.'], ans: ['t'], why: 'Both are 3 steps from 0, on opposite sides: they are opposites.' },+ { parts: ['On a thermometer, temperatures below 0 are negative.'], ans: ['t'], why: 'On an upright number line, below 0 is negative.' },+ { parts: ['The opposite of a negative number is negative.'], ans: ['f'], why: 'Flipping across 0 changes the side: the opposite of a negative number is positive.' },+];+boot();+</script>+</body>+</html>diff --git a/site/math-notebook/ch03/audio/en/distance.mp3 b/site/math-notebook/ch03/audio/en/distance.mp3new file mode 100644index 0000000..94c6b86Binary files /dev/null and b/site/math-notebook/ch03/audio/en/distance.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/final1.mp3 b/site/math-notebook/ch03/audio/en/final1.mp3new file mode 100644index 0000000..9eb9699Binary files /dev/null and b/site/math-notebook/ch03/audio/en/final1.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/final2.mp3 b/site/math-notebook/ch03/audio/en/final2.mp3new file mode 100644index 0000000..6a934d3Binary files /dev/null and b/site/math-notebook/ch03/audio/en/final2.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/final3.mp3 b/site/math-notebook/ch03/audio/en/final3.mp3new file mode 100644index 0000000..63964cdBinary files /dev/null and b/site/math-notebook/ch03/audio/en/final3.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/final4.mp3 b/site/math-notebook/ch03/audio/en/final4.mp3new file mode 100644index 0000000..d19359cBinary files /dev/null and b/site/math-notebook/ch03/audio/en/final4.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/finish.mp3 b/site/math-notebook/ch03/audio/en/finish.mp3new file mode 100644index 0000000..ad02233Binary files /dev/null and b/site/math-notebook/ch03/audio/en/finish.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/inside.mp3 b/site/math-notebook/ch03/audio/en/inside.mp3new file mode 100644index 0000000..12b8900Binary files /dev/null and b/site/math-notebook/ch03/audio/en/inside.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/intro.mp3 b/site/math-notebook/ch03/audio/en/intro.mp3new file mode 100644index 0000000..694ff7bBinary files /dev/null and b/site/math-notebook/ch03/audio/en/intro.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/itself.mp3 b/site/math-notebook/ch03/audio/en/itself.mp3new file mode 100644index 0000000..5335ff9Binary files /dev/null and b/site/math-notebook/ch03/audio/en/itself.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/outside.mp3 b/site/math-notebook/ch03/audio/en/outside.mp3new file mode 100644index 0000000..a81e0a6Binary files /dev/null and b/site/math-notebook/ch03/audio/en/outside.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/pair.mp3 b/site/math-notebook/ch03/audio/en/pair.mp3new file mode 100644index 0000000..dfdeb29Binary files /dev/null and b/site/math-notebook/ch03/audio/en/pair.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/q1.mp3 b/site/math-notebook/ch03/audio/en/q1.mp3new file mode 100644index 0000000..6db67a8Binary files /dev/null and b/site/math-notebook/ch03/audio/en/q1.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/q2.mp3 b/site/math-notebook/ch03/audio/en/q2.mp3new file mode 100644index 0000000..e42c574Binary files /dev/null and b/site/math-notebook/ch03/audio/en/q2.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/q3.mp3 b/site/math-notebook/ch03/audio/en/q3.mp3new file mode 100644index 0000000..03c051fBinary files /dev/null and b/site/math-notebook/ch03/audio/en/q3.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/times.mp3 b/site/math-notebook/ch03/audio/en/times.mp3new file mode 100644index 0000000..5dcaf21Binary files /dev/null and b/site/math-notebook/ch03/audio/en/times.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/timings.js b/site/math-notebook/ch03/audio/en/timings.jsnew file mode 100644index 0000000..96e2f89--- /dev/null+++ b/site/math-notebook/ch03/audio/en/timings.js@@ -0,0 +1,546 @@+window.TIMINGS = {+ "intro": {+ "dur": 6.192,+ "marks": {+ "sub": 2.76+ },+ "cues": [+ [+ 0.104,+ "Chapter three."+ ],+ [+ 1.289,+ "Absolute value."+ ],+ [+ 2.76,+ "Forget which way."+ ],+ [+ 4.18,+ "How far is a number from zero?"+ ]+ ]+ },+ "distance": {+ "dur": 30.888,+ "marks": {+ "far": 1.68,+ "hops": 4.492,+ "h1": 5.742,+ "h2": 6.055,+ "h3": 6.719,+ "h4": 7.175,+ "steps": 8.112,+ "def": 15.039,+ "bars": 22.422,+ "read": 25.547+ },+ "cues": [+ [+ 0.117,+ "Here's our number line again."+ ],+ [+ 1.68,+ "How far is negative four from zero?"+ ],+ [+ 4.492,+ "Let's count the steps: one, two, three, four."+ ],+ [+ 8.112,+ "Four steps."+ ],+ [+ 9.18,+ "Walking left or walking right, a distance is just a length, so the distance is four."+ ],+ [+ 15.039,+ "That distance has a special name: absolute value."+ ],+ [+ 18.75,+ "The absolute value of a number is its distance from zero."+ ],+ [+ 22.422,+ "To write it, put two straight bars around the number."+ ],+ [+ 25.547,+ "You read this as: the absolute value of negative four is four."+ ]+ ]+ },+ "itself": {+ "dur": 27.6,+ "marks": {+ "seven": 2.305,+ "same": 5.938,+ "zero": 13.568,+ "never": 21.562+ },+ "cues": [+ [+ 0.104,+ "What about a positive number, like seven?"+ ],+ [+ 2.305,+ "Seven is seven steps from zero, to the right."+ ],+ [+ 5.938,+ "So the absolute value of seven is seven."+ ],+ [+ 8.945,+ "For a positive number, the absolute value is just the number itself."+ ],+ [+ 13.568,+ "And zero?"+ ],+ [+ 14.675,+ "Zero is zero steps away from itself, so the absolute value of zero is zero."+ ],+ [+ 21.562,+ "A distance can be zero, but it can never be negative."+ ],+ [+ 24.87,+ "So an absolute value is never negative."+ ]+ ]+ },+ "q1": {+ "dur": 3.384,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.159,+ "Think distance, not direction."+ ]+ ]+ },+ "pair": {+ "dur": 33.312,+ "marks": {+ "five": 2.669,+ "nfive": 5.247,+ "lift": 8.516,+ "same": 12.539,+ "split": 23.633,+ "sign": 27.188,+ "size": 29.766+ },+ "cues": [+ [+ 0.104,+ "Now look at five and negative five."+ ],+ [+ 2.669,+ "Five is five steps to the right of zero."+ ],+ [+ 5.247,+ "Negative five is five steps to the left."+ ],+ [+ 8.516,+ "Lift both distances off the line and lay them side by side."+ ],+ [+ 12.539,+ "Exactly the same length."+ ],+ [+ 14.388,+ "Opposites always have the same absolute value: the absolute value of negative five and the absolute value of five are both five."+ ],+ [+ 23.633,+ "So a number like negative five tells you two things."+ ],+ [+ 27.188,+ "Its sign tells you which side of zero it's on."+ ],+ [+ 29.766,+ "Its absolute value tells you how far away it is."+ ]+ ]+ },+ "world": {+ "dur": 39.336,+ "marks": {+ "diver": 4.935,+ "depth": 11.315,+ "bal": 17.995,+ "owe": 23.867,+ "how": 32.109+ },+ "cues": [+ [+ 0.104,+ "Absolute value shows up whenever you care about how much, and not which way."+ ],+ [+ 4.935,+ "A diver swims thirty feet below sea level."+ ],+ [+ 8.789,+ "Her position is negative thirty."+ ],+ [+ 11.315,+ "But her depth, how far down she is, is thirty feet: the absolute value of negative thirty."+ ],+ [+ 17.995,+ "Or say Maya's bank balance is negative forty-two dollars and seventy-five cents."+ ],+ [+ 23.867,+ "That means she owes forty-two dollars and seventy-five cents."+ ],+ [+ 28.151,+ "The size of her debt is the absolute value of her balance."+ ],+ [+ 32.109,+ "Positions and balances carry a sign."+ ],+ [+ 34.948,+ "Depths, distances and amounts owed are absolute values."+ ]+ ]+ },+ "q2": {+ "dur": 2.952,+ "marks": {},+ "cues": [+ [+ 0.091,+ "Quick check."+ ],+ [+ 1.159,+ "How much, without the sign?"+ ]+ ]+ },+ "inside": {+ "dur": 24.384,+ "marks": {+ "first": 4.779,+ "five": 7.969,+ "back": 10.846,+ "inside": 13.737,+ "abs": 15.781,+ "rule": 21.484+ },+ "cues": [+ [+ 0.104,+ "Absolute value bars are also grouping symbols, like parentheses."+ ],+ [+ 4.779,+ "That means you finish the work inside the bars first."+ ],+ [+ 7.969,+ "Here it's five minus three."+ ],+ [+ 9.805,+ "Start at five, and step three back."+ ],+ [+ 12.461,+ "You land on two."+ ],+ [+ 13.737,+ "So the inside becomes two."+ ],+ [+ 15.781,+ "Then take the absolute value."+ ],+ [+ 17.826,+ "Two is two steps from zero, so the answer is two."+ ],+ [+ 21.484,+ "Inside first, then the absolute value."+ ]+ ]+ },+ "outside": {+ "dur": 40.8,+ "marks": {+ "six": 2.708,+ "inside": 9.115,+ "then": 12.917,+ "flip": 16.732,+ "seven": 19.779,+ "inside2": 24.505,+ "wrong": 28.854,+ "flip2": 34.544,+ "rule": 38.672+ },+ "cues": [+ [+ 0.104,+ "Sometimes there's a sign outside the bars."+ ],+ [+ 2.708,+ "This one says: negative, the absolute value of six."+ ],+ [+ 7.214,+ "Think inside, then outside."+ ],+ [+ 9.115,+ "Inside: the absolute value of six is six."+ ],+ [+ 12.917,+ "Outside: a minus sign in front means the opposite."+ ],+ [+ 16.732,+ "And the opposite of six is negative six."+ ],+ [+ 19.779,+ "Now try: negative, the absolute value of negative seven."+ ],+ [+ 24.505,+ "Inside: the absolute value of negative seven is seven."+ ],+ [+ 28.854,+ "Careful here."+ ],+ [+ 29.961,+ "The two minus signs don't cancel each other, so the answer is not seven."+ ],+ [+ 34.544,+ "The minus outside flips seven over to negative seven."+ ],+ [+ 38.672,+ "Inside first, then outside."+ ]+ ]+ },+ "q3": {+ "dur": 3.36,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.133,+ "Inside first, then outside."+ ]+ ]+ },+ "times": {+ "dur": 18.72,+ "marks": {+ "front": 1.198,+ "inside": 6.862,+ "times": 11.68,+ "tapes": 14.583,+ "eight": 17.604+ },+ "cues": [+ [+ 0.104,+ "One more thing."+ ],+ [+ 1.198,+ "A number right in front of the bars means multiply, just like a number in front of parentheses."+ ],+ [+ 6.862,+ "Inside first: the absolute value of negative four is four."+ ],+ [+ 11.68,+ "Then multiply: two times four."+ ],+ [+ 14.583,+ "Two distances of four, laid end to end, make eight."+ ]+ ]+ },+ "ways": {+ "dur": 27.768,+ "marks": {+ "ways": 6.458,+ "same": 11.719,+ "var": 15.052,+ "ab": 17.76,+ "three": 19.596,+ "word": 22.721+ },+ "cues": [+ [+ 0.117,+ "By the way, multiplication can be written in several ways, not only with a times sign."+ ],+ [+ 6.458,+ "You can use a dot, two sets of parentheses, or a number touching parentheses."+ ],+ [+ 11.719,+ "All of these mean two times four, which is eight."+ ],+ [+ 15.052,+ "With letters, you just write them side by side."+ ],+ [+ 17.76,+ "a b means a times b, and three x means three times x."+ ],+ [+ 22.721,+ "A letter like x is called a variable."+ ],+ [+ 25.521,+ "It stands for a number we don't know yet."+ ]+ ]+ },+ "wrap": {+ "dur": 18.408,+ "marks": {+ "w1": 1.133,+ "w2": 3.828,+ "w3": 8.164,+ "w4": 12.956,+ "end": 16.211+ },+ "cues": [+ [+ 0.104,+ "Let's wrap up."+ ],+ [+ 1.133,+ "Absolute value is distance from zero."+ ],+ [+ 3.828,+ "It's never negative, and opposites share the same absolute value."+ ],+ [+ 8.164,+ "The bars group: work inside first, then apply any sign outside."+ ],+ [+ 12.956,+ "And a number in front of the bars means multiply."+ ],+ [+ 16.211,+ "Now try the chapter practice."+ ]+ ]+ },+ "final1": {+ "dur": 3.792,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Chapter practice."+ ],+ [+ 1.562,+ "Find each absolute value."+ ]+ ]+ },+ "final2": {+ "dur": 3.216,+ "marks": {},+ "cues": [+ [+ 0.091,+ "Now some with work inside or outside the bars."+ ]+ ]+ },+ "final3": {+ "dur": 2.424,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Absolute value in the real world."+ ]+ ]+ },+ "final4": {+ "dur": 2.616,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Last set."+ ],+ [+ 1.198,+ "True or false?"+ ]+ ]+ },+ "finish": {+ "dur": 2.592,+ "marks": {},+ "cues": [+ [+ 0.104,+ "That's chapter three."+ ],+ [+ 1.55,+ "Nice work."+ ]+ ]+ }+};diff --git a/site/math-notebook/ch03/audio/en/ways.mp3 b/site/math-notebook/ch03/audio/en/ways.mp3new file mode 100644index 0000000..6d001f8Binary files /dev/null and b/site/math-notebook/ch03/audio/en/ways.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/world.mp3 b/site/math-notebook/ch03/audio/en/world.mp3new file mode 100644index 0000000..1e34a3dBinary files /dev/null and b/site/math-notebook/ch03/audio/en/world.mp3 differdiff --git a/site/math-notebook/ch03/audio/en/wrap.mp3 b/site/math-notebook/ch03/audio/en/wrap.mp3new file mode 100644index 0000000..ebc9e48Binary files /dev/null and b/site/math-notebook/ch03/audio/en/wrap.mp3 differdiff --git a/site/math-notebook/ch03/index.html b/site/math-notebook/ch03/index.htmlnew file mode 100644index 0000000..9dfb33b--- /dev/null+++ b/site/math-notebook/ch03/index.html@@ -0,0 +1,390 @@+<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<title>Absolute Value</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 -->+<style>+ .screen .grid.text .row { grid-template-columns: minmax(0, 1fr) auto 40px; }+ .screen .grid.text .why { padding-left: 0; }+ .blanks .say { display: inline-block; width: 900px; font-size: 30px; vertical-align: middle; }+</style>+</head>+<body>+<script src="../lib/engine.js"></script>+<script src="audio/en/timings.js"></script>+<script>+'use strict';+const CHAPTER = { number: 3, title: 'Absolute Value', minutes: 9, language: 'en' };+AXIS.u = 80; // number line −8…8 across the stage (as in ch02)++/* ---------- chapter drawing helpers ---------- */+const mline = (p, parts, x, y, t0, fill = COL.chalk, size = 48, anchor = 'middle') => { const e = M(p, [].concat(parts), { x, y, size, fill, anchor, o: 0 }); show(e, t0); return e; };+const text = (p, str, x, y, t0, { size = 30, fill = COL.chalk, anchor = 'start', weight = 500, font = UI } = {}) => { const e = T(p, str, { x, y, size, fill, anchor, weight, font, o: 0 }); show(e, t0); return e; };+// Sign colour: positive blue, negative coral, zero chalk (engine POS / NEG).+const pnCol = v => v > 0 ? POS : v < 0 ? NEG : COL.chalk;+// Flip a dot across zero from a to b along an arc whose top is at y = peak (from ch02).+function pnFlip(p, a, b, t0, { peak = 420, dur = 1.5, g } = {}) {+ const x1 = X(a), x2 = X(b), cx = (x1 + x2) / 2, cy = 2 * peak - Y0;+ draw(path(p, `M${x1} ${Y0}Q${cx} ${cy} ${x2} ${Y0}`, { stroke: COL.task, 'stroke-width': 3, opacity: .85 }, { d: 0 }), t0, dur, io);+ if (!g) {+ g = G(p, { x: x1, y: Y0, o: 0 });+ mk('circle', { r: 12, fill: pnCol(a), stroke: COL.board, 'stroke-width': 2 }, g);+ show(g, t0, .15);+ }+ prog(q => { const u = 1 - q; put(g, { x: u * u * x1 + 2 * u * q * cx + q * q * x2, y: u * u * Y0 + 2 * u * q * cy + q * q * Y0 }); }, t0, dur, io);+ tw(g.firstChild, { c_fill: pnCol(b) }, t0 + dur * .45, .2, lin);+ return g;+}+// Tap points on the line, with visible dots at the candidates (from ch01).+const tapDots = (vals, ...rest) => (body, api) => {+ const ctl = tap(vals, ...rest)(body, api);+ for (const v of vals) {+ const g = landDot(S.q, v, 0, COL.task, fx);+ g.style.pointerEvents = 'none';+ S.dots[v] = g;+ }+ return ctl;+};+// blanks with a sentence before each box (from ch02); a leading + or $ and thousands commas are accepted.+const pnBlanks = rows => (body, api) => {+ const ctl = blanks(rows.map(({ say, ...r }) => r))(body, api);+ body.querySelectorAll('.bline').forEach((ln, i) => ln.prepend(h('span', 'say', [rich(rows[i].say, 30)])));+ const check = ctl.check;+ ctl.check = () => {+ body.querySelectorAll('input.box').forEach(b => { b.value = b.value.replace(/^\s*[+$]\s*/, '').replace(/(\d),(?=\d{3}\b)/g, '$1'); });+ check();+ };+ return ctl;+};+// Distance tape: an amber bar on the number line from a to b at height y, drawn from a towards b, with end caps+// and an optional label above its middle. Lives in its own group, so it can be lifted or slid. run = tw or fx.+function avTape(p, a, b, y, t0, { label, run = tw, w = 10 } = {}) {+ const g = G(p, { x: 0, y }), x0 = X(a), x1 = X(b), dur = .4 + Math.abs(b - a) * .1;+ const c0 = path(g, `M${x0} -15V15`, { stroke: COL.task, 'stroke-width': 3 }, { o: 0 });+ const bar = path(g, `M${x0} 0H${x1}`, { stroke: COL.task, 'stroke-width': w, 'stroke-linecap': 'butt', opacity: .9 }, { d: 0 });+ const c1 = path(g, `M${x1} -15V15`, { stroke: COL.task, 'stroke-width': 3 }, { o: 0 });+ run(c0, { o: 1 }, t0, .2); run(bar, { d: 1 }, t0, dur, lin); run(c1, { o: 1 }, t0 + dur - .1, .2);+ if (label) run(T(g, label, { x: (x0 + x1) / 2, y: -26, size: 30, fill: COL.task, anchor: 'middle', weight: 600, font: MATH, o: 0 }), { o: 1 }, t0 + dur, .3);+ return g;+}+// A vertical distance tape (depths): x, from y0 to y1.+function avVTape(p, x, y0, y1, t0, run = tw) {+ const dur = .5 + Math.abs(y1 - y0) / 500;+ run(path(p, `M${x - 15} ${y0}H${x + 15}`, { stroke: COL.task, 'stroke-width': 3 }, { o: 0 }), { o: 1 }, t0, .2);+ run(path(p, `M${x} ${y0}V${y1}`, { stroke: COL.task, 'stroke-width': 10, 'stroke-linecap': 'butt', opacity: .9 }, { d: 0 }), { d: 1 }, t0, dur, lin);+ run(path(p, `M${x - 15} ${y1}H${x + 15}`, { stroke: COL.task, 'stroke-width': 3 }, { o: 0 }), { o: 1 }, t0 + dur - .1, .2);+}+// Absolute value bars: an amber token, so the bars and the distance tapes share one colour.+const BAR = { t: '|', fill: COL.task };+const sv = v => ({ t: num(v), fill: pnCol(v) }); // a number token in its sign colour+// A row of hidden tokens; showT(row, i, j, t0) fades tokens i..j in.+const avRow = (p, items, x, y, size = 64, anchor = 'middle') => tokens(p, items, { x, y, size, anchor, o: 0 });+const showT = (row, i, j, t0, step = .08) => { for (let k = i; k <= j; k++) show(row[k], t0 + (k - i) * step, .4); };+// A box around tokens i..j of a row (a "do this first" frame).+function avBox(p, row, i, j, t0) {+ const l = row[i]._px - row[i]._w / 2, r = row[j]._px + row[j]._w / 2, s = row.size;+ const b = put(mk('rect', { x: l - 10, y: row.y - s * .92, width: r - l + 20, height: s * 1.24, rx: 10, fill: 'none', stroke: COL.task, 'stroke-width': 3, 'stroke-dasharray': '9 7' }, p), { o: 0 });+ show(b, t0, .3);+ return b;+}+// A small diver, swimming right, centred on (x, y).+function avDiver(p, x, y) {+ const g = G(p, { x, y, o: 0 });+ path(g, 'M-38 -2L-68 -16M-38 4L-68 16', { stroke: COL.chalk, 'stroke-width': 4 });+ mk('ellipse', { rx: 40, ry: 12, fill: COL.board, stroke: COL.chalk, 'stroke-width': 3 }, g);+ mk('rect', { x: -22, y: -24, width: 30, height: 11, rx: 5, fill: COL.board, stroke: COL.chalk, 'stroke-width': 2.5 }, g);+ mk('circle', { cx: 52, cy: -3, r: 13, fill: COL.board, stroke: COL.chalk, 'stroke-width': 3 }, g);+ mk('rect', { x: 52, y: -9, width: 12, height: 8, rx: 2, fill: COL.whole, opacity: .8 }, g);+ for (const [bx, by, r] of [[70, -28, 5], [78, -48, 4], [72, -66, 3]]) mk('circle', { cx: bx, cy: by, r, fill: 'none', stroke: COL.dim, 'stroke-width': 2 }, g);+ return g;+}+// A small submarine centred on (x, y) (from ch02's drawing).+function avSub(p, x, y) {+ const g = G(p, { x, y, o: 0 });+ mk('ellipse', { rx: 44, ry: 15, fill: COL.board, stroke: COL.chalk, 'stroke-width': 3 }, g);+ mk('rect', { x: -10, y: -28, width: 22, height: 14, rx: 3, fill: COL.board, stroke: COL.chalk, 'stroke-width': 3 }, g);+ path(g, 'M4 -28V-40H14', { stroke: COL.chalk, 'stroke-width': 3 });+ return g;+}+// Sea-level scale for the depth questions (q2): feet from −150 to 50, submarine at −120.+const Q2Y = v => 300 - v * 3;+const Q2POS = { x: 760, y: 120, w: 800, cls: 'side', maxH: 640 };++/* ---------- beats: [id, title, run(m, D), { ask }?] ---------- */+const BEATS = [+ ['intro', 'Absolute value', (m, D) => {+ const g = G(scene, { o: 0, y: 24 });+ T(g, 'Unit 1 · The Number System · Chapter 3', { x: 800, y: 330, size: 28, fill: COL.dim, anchor: 'middle' });+ T(g, 'Absolute Value', { x: 800, y: 450, size: 96, weight: 600, anchor: 'middle' });+ tw(g, { o: 1, y: 0 }, .2, 1.1, out);+ const mini = G(scene, { o: 0 }); // a tiny line: two equal amber distances from 0+ path(mini, 'M600 600H1000', { stroke: COL.dim, 'stroke-width': 3 });+ const ta = path(mini, 'M800 600H680', { stroke: COL.task, 'stroke-width': 8, 'stroke-linecap': 'butt' }, { d: 0 });+ const tb = path(mini, 'M800 600H920', { stroke: COL.task, 'stroke-width': 8, 'stroke-linecap': 'butt' }, { d: 0 });+ mk('circle', { cx: 680, cy: 600, r: 9, fill: NEG }, mini);+ mk('circle', { cx: 920, cy: 600, r: 9, fill: POS }, mini);+ mk('circle', { cx: 800, cy: 600, r: 8, fill: COL.chalk }, mini);+ show(mini, .9, .6); draw(ta, 1.3, .6); draw(tb, 1.3, .6);+ const r = text(scene, 'How far is a number from zero?', 800, 700, m('sub'), { size: 34, fill: COL.dim, anchor: 'middle' });+ tw(g, { o: 0, y: -24 }, D - .9, .8); hide(r, D - .9, .8); hide(mini, D - .9, .8);+ }],+ ['distance', 'Distance from zero', (m) => {+ const p = panel(0);+ numberLine(.3, -8, 8);+ landDot(p, -4, .8, NEG);+ const qn = text(p, 'How far is −4 from 0?', 800, 190, m('far'), { size: 40, anchor: 'middle', weight: 600 });+ for (let k = 0; k < 4; k++) {+ const a = X(-k), b = X(-k - 1), t = m('h' + (k + 1), -.12);+ draw(path(p, `M${a} ${Y0 - 14}Q${(a + b) / 2} ${Y0 - 72} ${b} ${Y0 - 14}`, { stroke: COL.task, 'stroke-width': 3 }, { d: 0 }), t, .3, lin);+ text(p, String(k + 1), (a + b) / 2, Y0 - 82, t + .15, { size: 28, fill: COL.task, anchor: 'middle', weight: 700 });+ }+ avTape(p, 0, -4, Y0 + 100, m('steps'));+ text(p, 'distance: 4', X(-2), Y0 + 150, m('steps', .9), { size: 30, fill: COL.task, anchor: 'middle', weight: 600 });+ hide(qn, m('def', -.2), .4);+ text(p, 'Absolute value: a number’s distance from 0', 800, 190, m('def', .2), { size: 40, anchor: 'middle', weight: 700 });+ const row = avRow(p, [BAR, sv(-4), BAR, ' = ', sv(4)], 800, 330, 84);+ show(row[1], m('bars'), .4);+ for (const [k, dx] of [[0, -50], [2, 50]]) { put(row[k], { x: row[k]._px + dx }); tw(row[k], { o: 1, x: row[k]._px }, m('bars', .8), .6, out); }+ text(p, 'read: “the absolute value of −4”', 800, 400, m('read'), { size: 28, fill: COL.dim, anchor: 'middle' });+ showT(row, 3, 4, m('read', 3.2));+ }],+ ['itself', 'Positive numbers and zero', (m) => {+ const p = panel(0);+ landDot(p, 7, .3, POS);+ for (let k = 0; k < 7; k++) {+ const a = X(k), b = X(k + 1);+ draw(path(p, `M${a} ${Y0 - 14}Q${(a + b) / 2} ${Y0 - 72} ${b} ${Y0 - 14}`, { stroke: COL.task, 'stroke-width': 3 }, { d: 0 }), m('seven', k * .22), .22, lin);+ }+ avTape(p, 0, 7, Y0 + 100, m('seven', 1.7));+ text(p, 'distance: 7', X(3.5), Y0 + 150, m('seven', 2.6), { size: 30, fill: COL.task, anchor: 'middle', weight: 600 });+ const r7 = avRow(p, [BAR, sv(7), BAR, ' = ', sv(7)], X(3.5), 360, 72);+ showT(r7, 0, 4, m('same'));+ text(p, 'positive: the number itself', X(3.5), 430, m('same', 2.4), { size: 28, fill: COL.dim, anchor: 'middle' });+ const z = landDot(p, 0, m('zero'), COL.chalk);+ pulse(z, m('zero', 1.6), 1.7);+ const r0 = avRow(p, [BAR, sv(0), BAR, ' = ', sv(0)], X(-4), 360, 72);+ showT(r0, 0, 4, m('zero', 2.2));+ text(p, '0 steps from itself', X(-4), 430, m('zero', 3), { size: 28, fill: COL.dim, anchor: 'middle' });+ text(p, 'An absolute value is never negative.', 800, 180, m('never', 1.6), { size: 40, anchor: 'middle', weight: 700 });+ text(p, 'A distance can be 0, but never less than 0.', 800, 236, m('never', 2.4), { size: 30, fill: COL.dim, anchor: 'middle' });+ }],+ ['q1', 'Quick check', () => { panel(0); }, { ask: done => quiz(BAND, [+ { id: 'c-abs2', prompt: ['Tap the number whose absolute value is ', $m('2'), '.'],+ build: tapDots([-3, -2, 0, 3], -2, '−2 is 2 steps from 0, so |−2| = 2.',+ v => v === -3 ? 'That is −3: it is 3 steps from 0, so |−3| = 3.'+ : v === 0 ? 'That is 0: it is 0 steps from itself, so |0| = 0.' : 'That is 3: |3| = 3. Look for a number exactly 2 steps from 0, on either side.',+ () => { avTape(S.q, 0, -2, Y0 - 50, 0, { run: fx, label: '2' }); floatText('|−2| = 2', X(-2), Y0 - 120, COL.good); }) },+ { id: 'c-farther', prompt: ['Which number has the greater absolute value? Tap it.'],+ build: tapDots([-6, 4], -6, '−6 is 6 steps from 0, and 4 is only 4 steps: |−6| = 6 is greater than |4| = 4.',+ () => '4 is the greater number, but it is closer to 0. Absolute value measures distance from 0.',+ () => { avTape(S.q, 0, -6, Y0 - 50, 0, { run: fx, label: '6' }); avTape(S.q, 0, 4, Y0 - 50, .4, { run: fx, label: '4' }); }) },+ ], done) }],+ ['pair', 'Opposites, same distance', (m) => {+ const p = panel(0);+ landDot(p, 5, .3, POS); landDot(p, -5, .5, NEG);+ const t5 = avTape(p, 0, 5, Y0, m('five'), { w: 12 });+ const tn = avTape(p, 0, -5, Y0, m('nfive'), { w: 12 });+ tw(tn, { x: 200, y: 300 }, m('lift'), 1.4);+ tw(t5, { x: -200, y: 370 }, m('lift', .2), 1.4);+ const ln = avRow(p, [BAR, sv(-5), BAR], 570, 314, 50, 'end'); showT(ln, 0, 2, m('lift', 1.6));+ const lp = avRow(p, [BAR, sv(5), BAR], 570, 384, 50, 'end'); showT(lp, 0, 2, m('lift', 1.8));+ draw(path(p, 'M1030 282Q1052 282 1052 300V318Q1052 335 1068 335Q1052 335 1052 352V370Q1052 388 1030 388', { stroke: COL.chalk, 'stroke-width': 3 }, { d: 0 }), m('same'), .5);+ showT(avRow(p, ['= ', sv(5)], 1084, 352, 52, 'start'), 0, 1, m('same', .4));+ text(p, 'Opposites have the same absolute value.', 800, 190, m('same', 1.4), { size: 40, anchor: 'middle', weight: 700 });+ const big = avRow(p, [{ t: '−', fill: NEG }, { t: '5', fill: NEG }], 800, 790, 72);+ showT(big, 0, 1, m('split'), 0);+ tw(big[0], { x: 620 }, m('sign'), .7);+ text(p, 'sign: which side of 0', 620, 850, m('sign', .5), { size: 28, fill: NEG, anchor: 'middle', weight: 600 });+ tw(big[1], { x: 980, o: 0 }, m('size'), .7);+ mline(p, ['5'], 980, 790, m('size', .3), COL.task, 72);+ text(p, 'absolute value: how far', 980, 850, m('size', .5), { size: 28, fill: COL.task, anchor: 'middle', weight: 600 });+ }],+ ['world', 'How much, not which way', (m) => {+ const p = panel(0);+ hide(S.line, 0, .4);+ const Yf = v => 300 - v * 11;+ vAxis(p, { x: 300, Yf, lo: -40, hi: 10, step: 10, t0: .3 });+ text(p, 'feet', 300, 160, .5, { size: 26, fill: COL.dim, anchor: 'middle' });+ draw(path(p, `M320 ${Yf(0)}q16 -10 32 0t32 0t32 0t32 0t32 0t32 0t32 0t32 0t32 0t32 0`, { stroke: COL.dim, 'stroke-width': 3 }, { d: 0 }), .5, .8);+ text(p, 'sea level', 650, Yf(0) + 8, .9, { size: 22, fill: COL.dim, weight: 600 });+ show(avDiver(p, 520, Yf(-30)), m('diver'));+ const dd = G(p, { x: 300, y: Yf(-30), s: 0, o: 0 }); mk('circle', { r: 10, fill: NEG }, dd); pop(dd, m('diver', .6));+ text(p, 'position: −30 ft', 610, Yf(-30) + 10, m('diver', 1.6), { size: 30, fill: NEG, weight: 600 });+ avVTape(p, 360, Yf(0), Yf(-30), m('depth'));+ text(p, 'depth: 30 ft', 390, 430, m('depth', 1.2), { size: 30, fill: COL.task, weight: 600 });+ mline(p, ['|', '−30', '| = 30'], 390, 490, m('depth', 3), COL.chalk, 40, 'start');+ const card = G(p, { o: 0 });+ mk('rect', { x: 900, y: 190, width: 560, height: 220, rx: 18, fill: 'none', stroke: COL.dim, 'stroke-width': 2.5 }, card);+ T(card, 'Maya’s account balance', { x: 1180, y: 250, size: 28, fill: COL.dim, anchor: 'middle', weight: 600 });+ M(card, ['−$42.75'], { x: 1180, y: 350, size: 72, fill: NEG });+ show(card, m('bal'));+ text(p, 'she owes $42.75', 1180, 490, m('owe'), { size: 34, fill: COL.task, anchor: 'middle', weight: 600 });+ const r = avRow(p, [BAR, sv(-42.75), BAR, ' = ', sv(42.75)], 1180, 570, 50);+ showT(r, 0, 4, m('owe', 2.4));+ text(p, 'with a sign: position, balance', 800, 770, m('how'), { size: 30, fill: COL.chalk, anchor: 'middle', weight: 600 });+ text(p, 'absolute value: depth, distance, amount owed', 800, 822, m('how', 2), { size: 30, fill: COL.task, anchor: 'middle', weight: 600 });+ }],+ ['q2', 'Quick check', () => {+ const p = panel(0);+ vAxis(p, { x: 300, Yf: Q2Y, lo: -150, hi: 50, step: 50, t0: .1 });+ text(p, 'feet', 300, 120, .2, { size: 26, fill: COL.dim, anchor: 'middle' });+ draw(path(p, `M320 ${Q2Y(0)}q16 -10 32 0t32 0t32 0t32 0t32 0t32 0t32 0t32 0t32 0`, { stroke: COL.dim, 'stroke-width': 3 }, { d: 0 }), .2, .6);+ show(avSub(p, 500, Q2Y(-120)), .3);+ const d = G(p, { x: 300, y: Q2Y(-120), s: 0, o: 0 }); mk('circle', { r: 10, fill: NEG }, d); pop(d, .4);+ text(p, '−120 ft', 560, Q2Y(-120) + 10, .5, { size: 30, fill: NEG, weight: 600 });+ }, { ask: done => quiz(Q2POS, [+ { id: 'c-depth', prompt: ['The submarine is at ', $m('−120'), ' feet. How many feet below sea level is it?'],+ build: blanks([{ parts: [{ box: '120' }, ' feet'], why: 'Its depth is the distance from sea level: |−120| = 120 feet.',+ hint: 'How far is −120 from 0? Leave off the sign.',+ fx: () => { const L = S.q || qlayer(); avVTape(L, 360, Q2Y(0), Q2Y(-120), fx); floatText('depth 120 ft', 440, Q2Y(-60), COL.good); } }]) },+ { id: 'c-debt', prompt: ['Leo’s account balance is ', $m('−$18.25'), '. How much money does he owe?'],+ build: blanks([{ parts: ['$', { box: '18.25' }], why: 'He owes the size of the balance: |−18.25| = 18.25 dollars.',+ hint: 'A negative balance is a debt. The amount owed is its absolute value.' }]) },+ ], done) }],+ ['inside', 'Inside the bars first', (m) => {+ const p = panel(0);+ show(S.line, .2, .5);+ const row = avRow(p, [BAR, '5 − 3', BAR, ' = ', BAR, sv(2), BAR, ' = ', sv(2)], 800, 250, 72);+ showT(row, 0, 2, .4);+ const box = avBox(p, row, 1, 1, m('first'));+ move(p, 0, 5, 520, m('five'));+ move(p, 5, 2, 460, m('back'));+ landDot(p, 2, m('back', 1.2), POS);+ hide(box, m('inside'), .3);+ showT(row, 3, 6, m('inside'));+ avTape(p, 0, 2, Y0 + 100, m('abs'));+ text(p, 'distance: 2', X(1), Y0 + 150, m('abs', .7), { size: 30, fill: COL.task, anchor: 'middle', weight: 600 });+ showT(row, 7, 8, m('abs', 2.4));+ text(p, 'Inside first, then the absolute value.', 800, 370, m('rule'), { size: 34, anchor: 'middle', weight: 600 });+ }],+ ['outside', 'A sign outside the bars', (m) => {+ const p = panel(0);+ const r1 = avRow(p, ['−', BAR, sv(6), BAR, ' = ', '−(', sv(6), ')', ' = ', sv(-6)], 560, 200, 60, 'start');+ const r2 = avRow(p, ['−', BAR, sv(-7), BAR, ' = ', '−(', sv(7), ')', ' = ', sv(-7)], 560, 300, 60, 'start');+ showT(r1, 0, 3, .4);+ pulse(r1[0], m('six', 4.6), 1.5);+ showT(r1, 4, 7, m('inside', .3));+ const d6 = landDot(p, 6, m('inside', .8), POS);+ pulse(r1[0], m('then', .2), 1.6);+ pnFlip(p, 6, -6, m('flip'), { peak: 420, g: d6 });+ showT(r1, 8, 9, m('flip', 1.4));+ showT(r2, 0, 3, m('seven'));+ showT(r2, 4, 7, m('inside2', .3));+ const d7 = landDot(p, 7, m('inside2', .8), POS);+ const ghost = G(p, { x: r2[9]._px, y: 300, o: 0 });+ M(ghost, ['7'], { size: 60, fill: COL.bad });+ path(ghost, 'M-24 8L24 -48', { stroke: COL.bad, 'stroke-width': 4 });+ show(r2[8], m('wrong'), .4); show(ghost, m('wrong', .3), .4);+ text(p, 'not 7', r2[9]._px + 46, 290, m('wrong', 1), { size: 26, fill: COL.bad, weight: 600 });+ hide(ghost, m('flip2'), .4);+ pnFlip(p, 7, -7, m('flip2'), { peak: 380, g: d7 });+ show(r2[9], m('flip2', 1.4), .4);+ text(p, 'Inside first, then outside.', 800, 780, m('rule'), { size: 34, anchor: 'middle', weight: 600 });+ }],+ ['q3', 'Quick check', () => { panel(0); }, { ask: done => quiz(BAND, [+ { id: 'c-outside', prompt: ['Tap ', $m('−|−3|'), ' on the number line.'],+ build: tapDots([-4, -3, 3, 4], -3, 'Inside: |−3| = 3. Outside: the minus makes it the opposite, −3.',+ v => v === 3 ? 'That is |−3| only. Now apply the minus outside the bars.'+ : 'Count again: −3 is 3 steps from 0, so |−3| = 3, not 4.',+ () => floatText('−|−3| = −(3) = −3', X(-3), Y0 - 50, COL.good)) },+ { id: 'c-inside', prompt: ['Tap ', $m('|6 − 2|'), ' on the number line.'],+ build: tapDots([-4, -2, 2, 4], 4, 'Inside first: 6 − 2 = 4. Then |4| = 4.',+ v => v < 0 ? 'An absolute value is never negative. Work out 6 − 2 first.'+ : 'Do the inside first: 6 − 2 is 4, not 2.',+ () => { avTape(S.q, 0, 4, Y0 - 50, 0, { run: fx, label: '4' }); floatText('|6 − 2| = |4| = 4', X(4), Y0 - 120, COL.good); }) },+ ], done) }],+ ['times', 'A number in front', (m) => {+ const p = panel(0);+ const row = avRow(p, ['2', BAR, sv(-4), BAR, ' = ', '2 · 4', ' = ', sv(8)], 800, 230, 72);+ showT(row, 0, 3, .4);+ pulse(row[0], m('front', .4), 1.5);+ text(p, 'a number in front of the bars means multiply', 800, 320, m('front', 1.4), { size: 30, fill: COL.dim, anchor: 'middle' });+ landDot(p, -4, m('inside'), NEG);+ const ta = avTape(p, 0, -4, Y0 - 50, m('inside', .5), { label: '4' });+ showT(row, 4, 5, m('times'));+ tw(ta, { x: X(4) - X(0) }, m('tapes'), 1.1);+ avTape(p, 4, 8, Y0 - 50, m('tapes', 1.3), { label: '4' });+ landDot(p, 8, m('eight'), POS);+ showT(row, 6, 7, m('eight', .3));+ }],+ ['ways', 'Ways to write multiply', (m) => {+ const p = panel(0);+ hide(S.line, 0, .4);+ text(p, 'all of these mean multiply', 470, 170, .3, { size: 28, fill: COL.dim, anchor: 'middle', weight: 600 });+ const opts = { xEq: 540, size: 56 };+ [['2 × 4', .4], ['2 · 4', m('ways', .4)], ['(2)(4)', m('ways', 1.4)], ['2(4)', m('ways', 3.2)]]+ .map(([l, t], i) => eqLine(p, [l], ['8'], 270 + i * 100, t, opts));+ draw(path(p, 'M616 222H630V584H616', { stroke: COL.task, 'stroke-width': 3 }, { d: 0 }), m('same'), .6);+ text(p, 'all the same: 8', 650, 413, m('same', .5), { size: 28, fill: COL.task, weight: 600 });+ text(p, 'with letters', 1170, 170, m('var'), { size: 28, fill: COL.dim, anchor: 'middle', weight: 600 });+ eqLine(p, ['ab'], ['a · b'], 300, m('ab'), { xEq: 1170, size: 56 });+ eqLine(p, ['3x'], ['3 · x'], 410, m('three'), { xEq: 1170, size: 56 });+ show(put(mk('circle', { cx: 1170 - 56 * .6 - mathW(['x'], 56) / 2 + 6, cy: 395, r: 21, fill: 'none', stroke: COL.task, 'stroke-width': 3 }, p), { o: 0 }), m('word', .2), .4);+ text(p, 'Variable: a letter that stands for a number we don’t know yet', 800, 740, m('word', .6), { size: 34, fill: COL.task, anchor: 'middle', weight: 600 });+ }],+ ['wrap', 'Summary', (m) => {+ const p = panel(0);+ [['Absolute value is distance from 0: |−4| = 4 and |7| = 7.', 'w1'],+ ['It is never negative, and opposites share it: |−5| = |5| = 5.', 'w2'],+ ['Inside the bars first, then the sign outside: −|−7| = −7.', 'w3'],+ ['A number in front means multiply: 2|−4| = 2 · 4 = 8.', 'w4']].forEach(([str, mk_], i) => {+ const g = G(p, { x: -16, y: 250 + i * 130, o: 0 });+ mk('circle', { cx: 200, cy: -12, r: 26, fill: COL.task }, g);+ T(g, String(i + 1), { x: 200, y: -1, size: 30, fill: COL.board, weight: 700, anchor: 'middle' });+ T(g, str, { x: 260, size: 34, weight: 600 });+ tw(g, { o: 1, x: 0 }, m(mk_), .6);+ });+ }],+ ['final1', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{+ id: 'p-evaluate', prompt: ['Find each absolute value.'],+ build: blanks(PRACTICE1),+ }], done, 'Chapter practice 1 of 4') }],+ ['final2', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{+ id: 'p-steps', prompt: ['Evaluate: inside the bars first, then outside.'],+ build: blanks(PRACTICE2),+ }], done, 'Chapter practice 2 of 4') }],+ ['final3', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{+ id: 'p-world', prompt: ['Answer with a number (no sign needed).'],+ build: pnBlanks(PRACTICE3),+ }], done, 'Chapter practice 3 of 4') }],+ ['final4', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{+ id: 'p-truefalse', prompt: ['True or false?'],+ build: grid(PRACTICE4, TF, { multi: false, text: true }),+ }], done, 'Chapter practice 4 of 4') }],+ ['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],+].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));++/* ---------- practice data ---------- */+const PRACTICE1 = [+ { parts: ['|−23| = ', { box: '23' }], why: '−23 is 23 steps from 0.', hint: 'Distance from 0 is never negative.' },+ { parts: ['|61| = ', { box: '61' }], why: 'A positive number is its own absolute value.', hint: 'How far is 61 from 0?' },+ { parts: ['|−3.5| = ', { box: '3.5' }], why: '−3.5 is 3.5 units from 0.', hint: 'Decimals work the same way: keep the size, drop the sign.' },+ { parts: ['|−', F(3, 8), '| = ', { box: '3/8' }], why: '−3/8 is 3/8 of a unit from 0.', hint: 'Write the fraction without its sign, like 1/2.' },+ { parts: ['|0| = ', { box: '0' }], why: '0 is 0 steps from itself.', hint: 'How far is 0 from 0?' },+];+const PRACTICE2 = [+ { parts: ['|9 − 4| = ', { box: '5' }], why: 'Inside first: 9 − 4 = 5, and |5| = 5.', hint: 'Work out 9 − 4 first.' },+ { parts: ['|3 · 4| = ', { box: '12' }], why: 'Inside first: 3 · 4 = 12, and |12| = 12.', hint: 'The dot means multiply: 3 · 4 first.' },+ { parts: ['−|38| = ', { box: '-38' }], why: '|38| = 38, then the minus outside: −38.', hint: 'The minus sign is outside the bars, so it stays.' },+ { parts: ['−|−12| = ', { box: '-12' }], why: '|−12| = 12, then the minus outside: −12. The two signs do not cancel.', hint: 'Inside: |−12| = 12. Then apply the minus outside.' },+ { parts: ['3|−5| = ', { box: '15' }], why: '|−5| = 5, then 3 · 5 = 15.', hint: 'A number in front means multiply: 3 times |−5|.' },+];+const PRACTICE3 = [+ { say: 'Theo’s balance is −$64.20. How many dollars does he owe?', parts: [{ box: '64.20' }], why: 'He owes |−64.20| = 64.20 dollars.', hint: 'The debt is the absolute value of the balance.' },+ { say: 'A cave floor is at −85 feet. How many feet below the ground is it?', parts: [{ box: '85' }], why: 'Its depth is |−85| = 85 feet.', hint: 'Depth is a distance from 0: no sign.' },+ { say: 'At night it is −9 °C. How many degrees below zero is that?', parts: [{ box: '9' }], why: '|−9| = 9 degrees below zero.', hint: 'How far is −9 from 0?' },+];+const PRACTICE4 = [+ { parts: [$m('|−8| = 8')], ans: ['t'], why: '−8 is 8 steps from 0.' },+ { parts: ['An absolute value can be negative.'], ans: ['f'], why: 'A distance is never negative: an absolute value is positive or 0.' },+ { parts: [$m('|−6|'), ' is greater than ', $m('|4|'), '.'], ans: ['t'], why: '|−6| = 6 and |4| = 4, and 6 is greater than 4.' },+ { parts: [$m('−|−2| = 2')], ans: ['f'], why: 'Inside: |−2| = 2. Then the minus outside: −2.' },+ { parts: [$m('|−10| = |10|')], ans: ['t'], why: 'Opposites are the same distance from 0: both are 10.' },+];+boot();+</script>+</body>+</html>diff --git a/site/math-notebook/index.html b/site/math-notebook/index.htmlnew file mode 100644index 0000000..900dd25--- /dev/null+++ b/site/math-notebook/index.html@@ -0,0 +1,320 @@+<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<title>Ace Math — an animated notebook</title>+<meta name="description" content="ONE SENTENCE ABOUT THE BOOK.">+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%231d2b27'/%3E%3Ctext x='32' y='45' text-anchor='middle' font-size='48' fill='%23f0b45a'%3E∞%3C/text%3E%3C/svg%3E">+<script src="unit-art.js"></script>+<link rel="expect" href="#ch01" blocking="render">+<style>+: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; }+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 { position: relative; max-width: 1212px; margin: 0 auto; padding: 28px 16px 0; }+.unit h2 { position: relative; display: flex; align-items: baseline; gap: 14px; min-height: 168px; margin: 0 0 16px; padding-top: 130px; font: 500 28px/1.2 var(--book); }+.unit .grid { position: relative; }+/* Each unit header is a strip of chalkboard with a sketch of its mathematics, drawn in the unit colour. */+.unit::before { content: ""; position: absolute; inset: 0 16px auto; height: 208px; border-radius: 22px; pointer-events: none;+ background: radial-gradient(ellipse 46% 90% at 74% 55%, color-mix(in srgb, var(--c) 11%, transparent), transparent 70%); }+.unit-art { position: absolute; top: 20px; right: 28px; width: min(580px, 56%); height: auto; overflow: visible; pointer-events: none;+ color: var(--c); fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; opacity: .78; }+.unit-art text { fill: currentColor; stroke: none; font-family: var(--book); font-style: italic; }+.unit-art .a { color: var(--chalk); opacity: .55; }+.unit-art .faint { opacity: .22; }+.unit-art .d { stroke-dasharray: 1 1; stroke-dashoffset: 1; }+.unit-art .t { opacity: 0; }+.seen .unit-art .d { animation: art-draw 1.1s cubic-bezier(.5, 0, .3, 1) forwards; animation-delay: calc(var(--k) * 55ms + 120ms); }+.seen .unit-art .t { animation: art-fade .6s ease-out forwards; animation-delay: calc(var(--k) * 55ms + 300ms); }+.seen .unit-art .a.t { animation-name: art-fade-a; }+@keyframes art-draw { to { stroke-dashoffset: 0; } }+@keyframes art-fade { to { opacity: 1; } }+@keyframes art-fade-a { to { opacity: .55; } }+/* After the drawing, each sketch keeps one small motion that belongs to its topic. */+.unit-art g { transform-box: fill-box; }+.seen .unit-art .swap-a { animation: swap-a 6s var(--ease) 2.4s infinite; }+.seen .unit-art .swap-b { animation: swap-b 6s var(--ease) 2.4s infinite; }+@keyframes swap-a { 0%, 30%, 100% { transform: none; } 45%, 80% { transform: translate(80px, 0); } 37% { transform: translate(40px, -30px); } 88% { transform: translate(40px, 30px); } }+@keyframes swap-b { 0%, 30%, 100% { transform: none; } 45%, 80% { transform: translate(-80px, 0); } 37% { transform: translate(-40px, 30px); } 88% { transform: translate(-40px, -30px); } }+.seen .unit-art .step { animation: art-fade .6s ease-out forwards, step 4s ease-in-out infinite; animation-delay: calc(var(--k) * 55ms + 300ms), calc(var(--k) * 300ms + 2s); }+@keyframes step { 0%, 20%, 100% { fill-opacity: 1; } 10% { fill-opacity: .3; } }+.unit-art .hop, .unit-art .ride { offset-rotate: 0deg; }+.seen .unit-art .hop { animation: art-fade .4s ease-out 2s forwards, along 3.4s linear 2s infinite; }+.seen .unit-art .ride { animation: art-fade .4s ease-out 2s forwards, along 4s ease-in-out 2s infinite alternate; }+@keyframes along { from { offset-distance: 0%; } to { offset-distance: 100%; } }+.unit-art .pie { stroke: currentColor; stroke-linecap: butt; stroke-dasharray: 0 100; }+.seen .unit-art .pie { animation: art-fade .4s ease-out 1.6s forwards, pie 5s var(--ease) 1.6s infinite; }+@keyframes pie { 0% { stroke-dasharray: 0 100; } 35%, 85% { stroke-dasharray: 25 100; } 100% { stroke-dasharray: 0 100; } }+.seen .unit-art .tilt { transform-box: view-box; transform-origin: 300px 72px; animation: tilt 4.8s ease-in-out 2s infinite; }+@keyframes tilt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-4deg); } 60% { transform: rotate(2deg); } }+.seen .unit-art .spin { transform-box: view-box; transform-origin: 320px 95px; animation: spin 5s cubic-bezier(.2, .7, .2, 1) 2s infinite; }+@keyframes spin { from { transform: rotate(0); } 70%, to { transform: rotate(1530deg); } }+.seen .unit-art .feed-in { animation: feed-in 4s ease-in-out 2s infinite; }+.seen .unit-art .feed-out { opacity: 0; animation: feed-out 4s ease-in-out 2s infinite; }+@keyframes feed-in { 0% { transform: none; opacity: 1; } 40% { transform: translate(100px, 0); opacity: 0; } 41%, 100% { transform: none; opacity: 0; } 95% { opacity: 1; } }+@keyframes feed-out { 0%, 45% { transform: translate(-40px, 0); opacity: 0; } 70%, 90% { transform: none; opacity: 1; } 100% { opacity: 0; } }+.unit-art .cell { opacity: .25; }+.seen .unit-art .cell { animation: cell 5s ease-in-out infinite; animation-delay: calc(var(--j) * .5s + 2s); }+@keyframes cell { 0%, 100% { opacity: .25; } 15%, 60% { opacity: 1; } }+.unit-art .cut, .unit-art .shade { opacity: 0; }+.seen .unit-art .cut { animation: cut 4s ease-in-out 2s infinite; }+@keyframes cut { 0%, 100% { opacity: 0; } 30%, 70% { opacity: .5; } }+.seen .unit-art .shade { animation: shade 1s ease-out 1.6s forwards; }+@keyframes shade { to { opacity: .14; } }+.seen .unit-art .diag { animation: art-draw 1.1s cubic-bezier(.5, 0, .3, 1) forwards, redraw 4s ease-in-out 2.5s infinite; }+@keyframes redraw { 0%, 15% { stroke-dashoffset: 1; } 50%, 100% { stroke-dashoffset: 0; } }+.seen .unit-art .root { animation: art-fade .4s ease-out 1.8s forwards, root 2.4s ease-in-out 2.2s infinite; }+@keyframes root { 0%, 100% { r: 7px; } 50% { r: 11px; } }+.seen .unit-art .breathe { transform-box: view-box; transform-origin: 380px 140px; animation: breathe 4s ease-in-out 2s infinite alternate; }+@keyframes breathe { from { transform: scaleY(1); } to { transform: scaleY(.35); } }+.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); }++.back-shelf { color: var(--dim); font: 13px var(--ui); text-decoration: none; white-space: nowrap; }+.back-shelf:hover { color: var(--chalk); }+.cover-back { position: absolute; top: 24px; left: 24px; }+.contents-back { margin-left: 16px; }++/* ---------- 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; }+ .contents-back { margin-left: 0; font-size: 11px; }+ #contents .top { flex-wrap: wrap; gap: 8px 12px; }+ .unit-art { width: calc(100% - 32px); right: 16px; opacity: .32; }+ .unit h2 { min-height: 0; padding-top: 104px; }+ .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; }+ .unit-art .d { stroke-dashoffset: 0; }+ .unit-art .t, .unit-art .cell { opacity: 1; }+ .unit-art .a.t { opacity: .55; }+ .unit-art .shade { opacity: .14; }+ .unit-art .pie { stroke-dasharray: 25 100; }+ .chalk span { opacity: .075; }+}+</style>+</head>+<body>+<section id="cover">+ <div class="chalk" aria-hidden="true"><!-- a few faint formulas or phrases from the book, drawn in chalk -->+ <span style="left:7%;top:13%;--d:1.6">−3 < −2 < −1</span>+ <span style="right:8%;top:17%;--d:1.9">√2 = 1.414213…</span>+ <span style="left:5%;bottom:20%;--d:2.2">0.25 = 1/4</span>+ <span style="right:6%;bottom:15%;--d:2.5">π = 3.14159…</span>+ </div>+ <svg class="mascot draw" id="guide" width="210" height="147"></svg>+ <p class="kicker">An animated book</p>+ <h1>Ace Math <i>&</i> the Big Fat Notebook</h1>+ <p class="lede">Middle-school math you can watch and try: numbers sort themselves into families, slide along the number line, and wait for you to place the next one.</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>+ <a class="back-shelf cover-back" href="../">← Back to the bookshelf</a>+</section>++<main id="contents">+ <header class="top">+ <a class="home" href="#book" aria-label="Back to the cover"><svg class="mascot" id="guideSmall" width="52" height="36"></svg><strong>Ace Math <i>&</i> the Big Fat Notebook</strong></a>+ <span class="prog" id="prog"></span>+ <a class="back-shelf contents-back" href="../">← Bookshelf</a>+ </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 = [ // [unit title, [[chapter title, minutes], ...]]; chapters are numbered in order. Add a chapter when its lesson is ready.+ ['The Number System', [['Types of Numbers and the Number Line', 9], ['Positive and Negative Numbers', 8], ['Absolute Value', 9]]],+];+const HUES = ['#f4a48c', '#86c9e8', '#f3c95c', '#e8a0c8', '#8fd6b0', '#bba8ee', '#f0b45a'];+const id = n => 'ch' + String(n).padStart(2, '0');+let P = {};+const BOOK_PROGRESS_KEY = 'animebook:progress:' + new URL('.', location.href).pathname;+try { P = JSON.parse(localStorage.getItem(BOOK_PROGRESS_KEY) || '{}'); } 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++}"><svg class="unit-art" viewBox="0 0 600 180" aria-hidden="true">${UNIT_ART[u] || ''}</svg><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;+// A unit's sketch draws itself the first time the unit scrolls into view.+const seen = new IntersectionObserver(es => es.forEach(e => { if (e.isIntersecting) { e.target.classList.add('seen'); seen.unobserve(e.target); } }), { threshold: .25 });+document.querySelectorAll('.unit').forEach(u => seen.observe(u));+const finished = [...done].filter(k => k <= total).length;+document.getElementById('prog').innerHTML = finished ? `<b>${finished}</b> of ${total} finished` : `${total} chapter${total === 1 ? '' : 's'}`;+const plural = (n, w) => `${n} ${w}${n === 1 ? '' : 's'}`;+document.getElementById('meta').textContent = `${plural(total, 'chapter')} · ${plural(UNITS.length, 'unit')} · 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>`;+}++// The cover and the contents share this page: no hash or #book shows the cover, #contents or #chNN 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 && location.hash !== '#book';+ 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) {+ const heading = document.querySelector(open ? '#contents .home' : '#cover h1');+ heading?.setAttribute('tabindex', '-1');+ heading?.focus({ preventScroll: true });+ }+ };+ if (animate && document.startViewTransition && !reduced) {+ const transition = document.startViewTransition(apply);+ // Navigation can interrupt either promise; the new view is already applied.+ transition.ready.catch(() => {});+ transition.finished.catch(() => {});+ } 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/math-notebook/lib/engine.css b/site/math-notebook/lib/engine.cssnew file mode 100644index 0000000..32acb76--- /dev/null+++ b/site/math-notebook/lib/engine.css@@ -0,0 +1,210 @@+:root {+ --page: #0f1613; --board: #1d2b27; --panel: #22322d; --edge: #3a5047;+ --chalk: #ece8dc; --dim: #9aaba3; --faint: #5d7068;+ --task: #f0b45a; --quiz: #86c9e8; --good: #8fd6b0; --bad: #f08c7a;+ --ui: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;+ color-scheme: dark;+}+* { box-sizing: border-box; }+html, body { height: 100%; margin: 0; overflow: hidden; background: var(--page); }+body { color: var(--chalk); font: 26px/1.4 var(--ui); }+button { font: inherit; color: inherit; cursor: pointer; }+button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--task); outline-offset: 3px; }+button[hidden] { display: none; }++/* One fixed 1600×960 frame (900 stage + 60 controls), scaled to fit the window. */+#frame { position: absolute; left: 50%; top: 50%; width: 1600px; height: 960px; transform: translate(-50%, -50%) scale(var(--k, .5));+ border-radius: 20px; overflow: hidden; background: var(--board); box-shadow: 0 0 0 1px var(--edge), 0 30px 80px rgba(0, 0, 0, .45); }+#stage { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; display: block; }+#ui { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; pointer-events: none; }+#ui > * { pointer-events: auto; }++.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 > 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; }++/* Question cards inside the picture. */+.card { position: absolute; padding: 20px 26px; border-radius: 20px; background: rgba(34, 50, 45, .97); border: 1.5px solid var(--edge); border-left: 7px solid var(--quiz); box-shadow: 0 14px 44px rgba(0, 0, 0, .35); }+.card.band { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "pic head body acts" "pic fb body acts"; column-gap: 28px; align-items: center; align-content: center; min-height: 150px; }+.band .mascot { grid-area: pic; }+.band .head { grid-area: head; align-self: end; }+.band .fb { grid-area: fb; align-self: start; }+.band .body { grid-area: body; }+.band .acts { grid-area: acts; }+.side .mascot { float: right; margin: -2px -4px 6px 10px; }+.kicker { margin: 0 0 4px; font-size: 20px; font-weight: 600; color: var(--quiz); }+.prompt { margin: 0; font-size: 28px; line-height: 1.35; }+.side .prompt { font-size: 24px; }+.body:empty { display: none; }+.side .body { margin-top: 14px; }+.opts { display: flex; gap: 12px; flex-wrap: wrap; }+.opt { padding: 8px 24px; border-radius: 999px; border: 2px solid var(--edge); background: transparent; color: var(--chalk); font-size: 24px; min-height: 58px; display: inline-flex; align-items: center; }+.opt:hover:not(:disabled) { border-color: var(--dim); }+.opt[aria-pressed="true"] { background: var(--c, var(--chalk)); border-color: var(--c, var(--chalk)); color: #1b2320; font-weight: 600; }+.opt.good { border-color: var(--good); box-shadow: 0 0 0 3px rgba(143, 214, 176, .35); }+.opt.bad { border-color: var(--bad); color: var(--bad); }+.opt:disabled { cursor: default; }+.fb { margin-top: 8px; font-size: 22px; line-height: 1.4; color: var(--chalk); }+.fb:empty { display: none; }+.fb.ok::before { content: "✓ "; color: var(--good); font-weight: 700; }+.fb.no::before { content: "✗ "; color: var(--bad); font-weight: 700; }+.fb ul { margin: 6px 0 0; padding-left: 22px; }+.side .fb { max-height: 110px; overflow: auto; font-size: 20px; }+.acts { display: flex; gap: 12px; align-items: center; }+.side .acts { margin-top: 16px; }+.side .acts { flex-wrap: wrap; gap: 10px; }+.side .btn { padding: 8px 16px; font-size: 20px; }+.card.side { padding: 18px 22px; }+.btn { padding: 10px 28px; border-radius: 999px; border: 0; background: var(--chalk); color: var(--board); font-weight: 600; font-size: 22px; white-space: nowrap; }+.btn.quiet { background: transparent; color: var(--dim); border: 1.5px solid var(--edge); }+.btn.go { background: var(--quiz); color: #10242e; }+.btn:disabled { background: var(--edge); color: var(--dim); cursor: default; }++.grid .row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 34px; gap: 16px; align-items: center; padding: 5px 0 5px 12px; border-bottom: 1px solid #2e433b; }+.grid .num { display: flex; justify-content: flex-end; align-items: center; font-size: 26px; }+.grid.text .row { grid-template-columns: minmax(0, 1fr) auto 34px; }+.grid.text .num { justify-content: flex-start; }+.grid .opts { gap: 8px; }+.grid .opt { padding: 3px 16px; min-height: 42px; font-size: 20px; }+.grid .mark { font-weight: 700; text-align: center; }+.grid .mark.good { color: var(--good); }+.grid .mark.bad { color: var(--bad); }+.grid .why { grid-column: 1 / -1; font-size: 19px; color: var(--dim); padding-left: 186px; }+.grid.text .why { padding-left: 0; }+.grid .why:empty { display: none; }++.hit { cursor: pointer; }+.hit .ring { fill: transparent; stroke: var(--chalk); stroke-width: 2.5; stroke-opacity: 0; }+.hit:hover .ring, .hit:focus .ring { stroke-opacity: .7; }+.hit.bad .ring { stroke: var(--bad); stroke-opacity: 1; }+.hit.good .ring { stroke: var(--good); stroke-opacity: 1; stroke-width: 4; }+.tok { cursor: grab; }++/* Controls strip, part of the frame. */+#bar { position: absolute; left: 0; top: 900px; width: 1600px; height: 60px; display: flex; align-items: center; gap: 10px; padding: 0 20px; background: #16211d; border-top: 1px solid #2a3b35; }+.icon { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--edge); background: var(--panel); display: grid; place-items: center; flex: none; padding: 0; }+.icon svg { width: 18px; height: 18px; fill: var(--chalk); }+.icon .i-pause { display: none; }+.is-playing .icon .i-play { display: none; }+.is-playing .icon .i-pause { display: block; }+.segs { flex: 1; display: flex; gap: 4px; height: 30px; align-items: center; min-width: 0; margin: 0 8px; }+.seg { position: relative; display: block; min-width: 0; height: 8px; border-radius: 4px; background: #2f4640; border: 0; padding: 0; overflow: hidden; }+.seg:hover { height: 12px; }+.seg i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--chalk); }+.seg.ask { background: #2d4a57; }+.seg.ask i { background: var(--quiz); }+.step { width: 300px; flex: none; color: var(--dim); font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }+.sound-note { position: absolute; left: 24px; top: 20px; margin: 0; padding: 8px 18px; border-radius: 12px; background: rgba(15, 22, 19, .85); color: var(--dim); font-size: 19px; }+.sound-note[hidden] { display: none; }+.blanks .brow { padding: 8px 0; border-bottom: 1px solid #2e433b; }+.blanks .brow:last-child { border-bottom: 0; }+.blanks .bline { line-height: 64px; white-space: nowrap; }+.blanks .mark { display: inline-block; margin-left: 14px; font-weight: 700; }+.blanks .mark.good { color: var(--good); animation: pop .35s ease-out; }+.blanks .mark.bad { color: var(--bad); }+.blanks .why { font-size: 19px; color: var(--dim); line-height: 1.35; }+.blanks .why:empty { display: none; }+.box { height: 52px; margin: 0 6px; padding: 0 6px; border: 0; border-bottom: 3px solid var(--quiz); border-radius: 8px 8px 0 0; background: rgba(236, 232, 220, .07); color: var(--chalk); font: 32px "STIX Two Text", "Cambria Math", "Iowan Old Style", Palatino, Georgia, serif; text-align: center; vertical-align: -6px; }+.box:focus { outline: none; background: rgba(134, 201, 232, .16); }+.box.good { border-color: var(--good); }+.box.bad { border-color: var(--bad); }+.box:disabled { opacity: 1; }+kbd { display: inline-block; min-width: 1.5em; padding: 0 .4em; margin-left: .5em; border: 1.5px solid currentColor; border-radius: 6px; font: 600 .7em/1.5 var(--ui); text-align: center; vertical-align: .12em; opacity: .6; }+.opt kbd { margin: 0 .6em 0 0; }+.keys { margin: 6px 0 0; font-size: 18px; color: var(--dim); }+.keys kbd { margin: 0 .15em; }+.grid .row.cur { background: rgba(236, 232, 220, .05); box-shadow: inset 4px 0 var(--quiz); }+.help { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; display: grid; place-items: center; background: rgba(10, 16, 14, .72); }+.help[hidden] { display: none; }+.help-box { width: 1120px; padding: 40px 50px; border-radius: 22px; background: var(--panel); border: 1.5px solid var(--edge); }+.help h2 { margin: 0 0 22px; font-size: 32px; font-weight: 600; }+.help h3 { margin: 0 0 12px; font-size: 20px; font-weight: 600; color: var(--quiz); }+.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }+.help dl { margin: 0; display: grid; grid-template-columns: 150px 1fr; row-gap: 10px; font-size: 22px; }+.help dt { text-align: right; padding-right: 18px; white-space: nowrap; }+.help dt kbd { margin: 0 0 0 .3em; opacity: .9; }+.help dd { margin: 0; color: var(--dim); }+.help-close { margin: 26px 0 0; font-size: 18px; color: var(--dim); }+.icon.txt { font-size: 20px; font-weight: 700; color: var(--dim); }+/* Optional captions of the narration, one sentence at a time. Off by default: teaching text lives in the picture. */+.caption { position: absolute; left: 50%; bottom: 78px; transform: translateX(-50%); width: max-content; max-width: 1180px; padding: 10px 24px; border-radius: 14px; background: rgba(10, 16, 14, .82); color: var(--chalk); font-size: 28px; line-height: 1.35; text-align: center; pointer-events: none; }+.caption[hidden] { display: none; }+.icon.cc { font-size: 15px; font-weight: 700; color: var(--dim); }+.icon.cc[aria-pressed="true"] { background: var(--chalk); border-color: var(--chalk); color: var(--board); }+.card.side { overflow: auto; }+svg.m { display: inline-block; overflow: visible; }+.card { animation: card-in .45s cubic-bezier(.2, .9, .3, 1.15); }+.fb:not(:empty) { animation: fb-in .3s ease-out; }+.opt.bad, .grid .mark.bad { animation: shake .4s; }+.grid .mark.good { animation: pop .35s ease-out; }+@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }+@keyframes fb-in { from { opacity: 0; transform: translateY(8px); } }+@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.3); } }+@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }+/* Full-screen chapter practice. */+.card.screen { height: 900px; padding: 50px 70px; border: 0; border-radius: 0; background: transparent; box-shadow: none; animation: screen-in .5s ease-out; max-height: none; overflow: visible; }+.screen .kicker { font-size: 22px; }+.screen .prompt { font-size: 40px; font-weight: 600; }+.screen .body { margin-top: 30px; }+.screen .fb { position: absolute; left: 70px; bottom: 56px; max-width: 1080px; margin: 0; font-size: 24px; }+.screen .acts { position: absolute; right: 70px; bottom: 48px; }+.screen .grid .row { grid-template-columns: 200px minmax(0, 1fr) 40px; padding: 9px 0 9px 12px; }+.screen .grid.text .row { grid-template-columns: minmax(0, 1fr) auto 40px; }+.screen .grid .opt { font-size: 22px; min-height: 50px; padding: 4px 20px; }+.screen .grid .why { padding-left: 216px; font-size: 20px; }+.screen .grid.text .why { padding-left: 0; }+#ui > .screen.sort { pointer-events: none; }+.screen.sort > * { pointer-events: auto; }+.screen.sort .head { position: absolute; right: 34px; top: 40px; width: 330px; }+.screen.sort .prompt { font-size: 28px; }+.screen.sort .fb { left: auto; right: 34px; bottom: 116px; width: 330px; max-height: 240px; overflow: auto; font-size: 20px; }+.screen.sort .acts { right: 34px; }+.fin .finwrap { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; padding-bottom: 60px; }+.fin .mascot { margin-bottom: 28px; }+.fin .fb, .fin .acts { position: static; }+.fin .acts { margin-top: 30px; }+@keyframes screen-in { from { opacity: 0; } }++/* The guide: an infinity sign whose loops are its eyes. */+.mascot { display: block; flex: none; overflow: visible; }+.mascot .mbody { transform-box: view-box; transform-origin: 60px 46px; animation: bob 3.4s ease-in-out infinite; }+.mascot .eyes { transition: transform .3s; }+.mascot .pupil { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }+.mascot .joy, .mascot .flat { display: none; }+.mascot.happy .pupil { display: none; }+.mascot.happy .joy { display: inline; }+.mascot.happy .mbody { animation: hop .55s ease-out 2, bob 3.4s ease-in-out 1.1s infinite; }+.mascot.oops .eyes { transform: translate(-3px, 4px); }+.mascot.oops .smile { display: none; }+.mascot.oops .flat { display: inline; }+.mascot.oops .mbody { animation: wobble .5s ease-in-out, bob 3.4s ease-in-out .5s infinite; }+@keyframes bob { 50% { transform: translateY(-3px) rotate(-2deg); } }+@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }+@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/math-notebook/lib/engine.js b/site/math-notebook/lib/engine.jsnew file mode 100644index 0000000..f54b0c4--- /dev/null+++ b/site/math-notebook/lib/engine.js@@ -0,0 +1,1637 @@+// AnimeBook lesson engine: stage, drawing, timeline, questions, player.+// A chapter page loads this file, defines CHAPTER and BEATS, then calls boot().+'use strict';+document.body.insertAdjacentHTML('afterbegin', `<div id="frame">+ <svg id="stage" viewBox="0 0 1600 900" role="img" aria-label="Lesson animation">+ <defs>+ <filter id="grain" x="0" y="0" width="100%" height="100%">+ <feTurbulence type="fractalNoise" baseFrequency=".85" numOctaves="2" seed="7" />+ <feColorMatrix values="0 0 0 0 .92 0 0 0 0 .95 0 0 0 0 .9 0 0 0 .07 0" />+ </filter>+ <radialGradient id="vignette" cx=".5" cy=".45" r=".75">+ <stop offset=".6" stop-color="#000" stop-opacity="0" />+ <stop offset="1" stop-color="#000" stop-opacity=".35" />+ </radialGradient>+ </defs>+ <rect width="1600" height="900" fill="#1d2b27" />+ <rect width="1600" height="900" filter="url(#grain)" />+ <rect width="1600" height="900" fill="url(#vignette)" />+ <g id="scene"></g>+ </svg>+ <div id="ui"></div>+ <div class="paused-mark"><div>Paused. Press space or click to continue.</div></div>+ <div class="caption" id="caption" hidden></div>+ <div class="help" id="help" hidden role="dialog" aria-label="Keyboard shortcuts">+ <div class="help-box">+ <h2>Keyboard shortcuts</h2>+ <div class="help-cols">+ <div><h3>Lesson</h3><dl>+ <dt><kbd>Space</kbd></dt><dd>Play or pause</dd>+ <dt><kbd>←</kbd><kbd>→</kbd></dt><dd>Previous or next step</dd>+ <dt><kbd>Shift</kbd><kbd>←</kbd><kbd>→</kbd></dt><dd>Change step during a question</dd>+ <dt><kbd>Home</kbd></dt><dd>Start over</dd>+ <dt><kbd>C</kbd></dt><dd>Captions on or off</dd>+ <dt><kbd>F</kbd></dt><dd>Full screen</dd>+ <dt><kbd>?</kbd></dt><dd>Show this list</dd>+ </dl></div>+ <div><h3>Questions</h3><dl>+ <dt><kbd>1</kbd>–<kbd>6</kbd></dt><dd>Choose an answer or a ring</dd>+ <dt><kbd>T</kbd><kbd>F</kbd></dt><dd>True or false</dd>+ <dt><kbd>↑</kbd><kbd>↓</kbd></dt><dd>Move between rows</dd>+ <dt><kbd>←</kbd><kbd>→</kbd></dt><dd>Move along the number line, or pick a number to sort</dd>+ <dt><kbd>Enter</kbd></dt><dd>Check, then continue</dd>+ <dt><kbd>S</kbd></dt><dd>Show the answer</dd>+ <dt><kbd>Esc</kbd></dt><dd>Leave an answer box</dd>+ </dl></div>+ </div>+ <p class="help-close">Press <kbd>Esc</kbd> to close.</p>+ </div>+ </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>+ <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>+ </button>+ <button class="icon" id="bBack" aria-label="Previous step (left arrow)">+ <svg viewBox="0 0 18 18"><path d="M3 2h2.5v14H3zM16 2v14L6.5 9z"/></svg>+ </button>+ <button class="icon" id="bRestart" aria-label="Restart lesson">+ <svg viewBox="0 0 18 18"><path d="M9 2.5a6.5 6.5 0 1 1-6.3 8.1l2-.5A4.5 4.5 0 1 0 9 4.5V7L4.5 3.5 9 0z"/></svg>+ </button>+ <div class="segs" id="segs"></div>+ <div class="step" id="stepName"></div>+ <button class="icon txt" id="bHelp" aria-label="Keyboard shortcuts (?)" title="Keyboard shortcuts (?)">?</button>+ <button class="icon cc" id="bCC" aria-pressed="false" aria-label="Captions (C)" title="Captions (C)">CC</button>+ <button class="icon" id="bFull" aria-label="Full screen">+ <svg viewBox="0 0 18 18"><path d="M1 1h6v2H3v4H1zM11 1h6v6h-2V3h-4zM1 11h2v4h4v2H1zM15 11h2v6h-6v-2h4z"/></svg>+ </button>+ </div>+</div>`);++/* ---------- drawing helpers ---------- */+const NS = 'http://www.w3.org/2000/svg';+const COL = { nat: '#f4a48c', whole: '#86c9e8', int: '#f3c95c', rat: '#e8a0c8', irr: '#8fd6b0', real: '#bba8ee',+ chalk: '#ece8dc', dim: '#9aaba3', faint: '#5d7068', task: '#f0b45a', good: '#8fd6b0', bad: '#f08c7a', board: '#1d2b27' };+const UI = '"Avenir Next","Segoe UI","Helvetica Neue",Arial,sans-serif';+const MATH = '"STIX Two Text","Cambria Math","Iowan Old Style",Palatino,Georgia,serif';+const NAME = { nat: 'Natural', whole: 'Whole', int: 'Integers', rat: 'Rational', irr: 'Irrational', real: 'Real' };+// Card positions inside the 1600×900 picture.+const BAND = { x: 96, y: 686, w: 1408, cls: 'band' }; // below the number line+const RIGHT = { x: 1258, y: 546, w: 330, cls: 'side', maxH: 346 }; // right of the number map+const TOPR = { x: 960, y: 70, w: 624, cls: 'side', maxH: 470 }; // top right, above the number line+const SCREEN = { x: 0, y: 0, w: 1600, cls: 'screen' };+const SORT_SCREEN = { x: 0, y: 0, w: 1600, cls: 'screen sort' };+const $m = (...parts) => ({ m: parts });++function mk(tag, attrs = {}, parent) {+ const e = document.createElementNS(NS, tag);+ for (const k in attrs) e.setAttribute(k, attrs[k]);+ if (parent) parent.appendChild(e);+ return e;+}+// Every animated element keeps a small state object; render() writes it to the DOM.+// Keys: x y s r o (transform/opacity), d (0..1 stroke drawn), a_<attr> numeric attr, c_<attr> hex colour.+function st(e) { return e._st || (e._st = { x: 0, y: 0, s: 1, r: 0, o: 1 }); }+function put(e, o) { Object.assign(st(e), o); render(e); return e; }+function render(e) {+ const s = e._st;+ if (s.x || s.y || s.s !== 1 || s.r) e.setAttribute('transform', `translate(${s.x},${s.y}) rotate(${s.r}) scale(${s.s})`);+ else e.removeAttribute('transform');+ e.setAttribute('opacity', s.o);+ if (s.d !== undefined) {+ e.setAttribute('stroke-dashoffset', 1 - s.d);+ e.style.visibility = s.d < .002 ? 'hidden' : '';+ }+ for (const k in s) {+ if (k.startsWith('a_')) e.setAttribute(k.slice(2), s[k]);+ else if (k.startsWith('c_')) e.setAttribute(k.slice(2), s[k]);+ }+}+function G(parent, o = {}) { return put(mk('g', {}, parent), o); }+function path(parent, d, attrs = {}, o = {}) {+ const p = mk('path', { d, fill: 'none', 'stroke-linecap': 'round', 'stroke-linejoin': 'round', ...attrs }, parent);+ if (o.d !== undefined) { p.setAttribute('pathLength', 1); p.setAttribute('stroke-dasharray', '1 1'); }+ return put(p, o);+}+function T(parent, str, { x = 0, y = 0, size = 30, fill = COL.chalk, font = UI, weight = 500, anchor = 'start', o = 1 } = {}) {+ const t = mk('text', { 'font-size': size, fill, 'font-family': font, 'font-weight': weight, 'text-anchor': anchor }, parent);+ t.textContent = str;+ t.style.whiteSpace = 'pre';+ return put(t, { x, y, o });+}+const ctx2d = document.createElement('canvas').getContext('2d');+function textW(str, size, italic = false) { ctx2d.font = `${italic ? 'italic ' : ''}${size}px ${MATH}`; return ctx2d.measureText(str).width; }+const VAR = /(?<![A-Za-z°])(?:(?!(?:of|in|is|to|or|at|on|by|as|an|if|it|be|no|so|up|we|my)(?![A-Za-z]))[a-z]{1,2}|(?!(?:If|In|It|Is|On|At|No|So|Or|An|As|To|By|Up)(?![A-Za-z]))[a-z]?[A-Z]{1,3}[a-z]?)(?![A-Za-z])/g; // capitals: A, PV, nRT // short lowercase runs are variables (a, x, ab), except short English words+const F = (n, d) => ({ f: [String(n), String(d)] }); // fraction+const R = (x, i) => ({ r: x && x.f ? x : String(x), i: i && String(i) }); // root of a number or of F(n, d); i = index, e.g. 3 for a cube root+const E = x => ({ sup: String(x) }); // exponent, raised after the part before it+const OV = x => ({ ov: String(x) }); // digits under a repeat bar: ['0.', OV('3')] is 0.333…+// Math expression from parts: 'text' | F(n,d) | R(x) | E(exp). Baseline at y; anchor start/middle/end.+function M(parent, parts, { x = 0, y = 0, size = 36, fill = COL.chalk, anchor = 'middle', o = 1, s = 1 } = {}) {+ const g = G(parent, { x, y, o, s });+ const inner = mk('g', {}, g);+ const lw = size * .05;+ const text = (str, tx, ty, sz) => {+ const t = mk('text', { x: tx, y: ty, 'font-size': sz, 'font-family': MATH, fill }, inner);+ t.style.whiteSpace = 'pre';+ let w = 0, last = 0;+ const run = (piece, italic) => {+ if (!piece) return;+ mk('tspan', italic ? { 'font-style': 'italic' } : {}, t).textContent = piece;+ w += textW(piece, sz, italic);+ };+ for (const m of str.matchAll(VAR)) { run(str.slice(last, m.index), false); run(m[0], true); last = m.index + m[0].length; }+ run(str.slice(last), false);+ return w;+ };+ const rule = (x1, x2, yy) => mk('path', { d: `M${x1} ${yy}H${x2}`, stroke: fill, 'stroke-width': lw, 'stroke-linecap': 'round' }, inner);+ let cx = 0;+ for (const p of parts) {+ if (typeof p === 'string') cx += text(p, cx, 0, size);+ else if (p.f) {+ const fs = size * .72, [n, d] = p.f, wn = textW(n, fs), wd = textW(d, fs);+ const w = Math.max(wn, wd) + size * .2, bar = -size * .3;+ text(n, cx + (w - wn) / 2, bar - size * .12, fs);+ text(d, cx + (w - wd) / 2, bar + size * .62, fs);+ rule(cx + size * .04, cx + w - size * .04, bar);+ cx += w + size * .04;+ } else if (p.r) {+ const fr = typeof p.r === 'object', mid = fr ? -size * .12 : -size * .3, bot = fr ? size * .45 : size * .06, top = fr ? -size * 1.12 : -size * .82;+ let x0 = cx + size * .04;+ if (p.i) { const iw = textW(p.i, size * .42); text(p.i, x0, mid - size * .14, size * .42); x0 += Math.max(0, iw - size * .12); } // index in the radical's crook+ let w;+ if (fr) { // a fraction under the radical, laid out like F()+ const fs = size * .72, [n, d] = p.r.f, wn = textW(n, fs), wd = textW(d, fs), bx = x0 + size * .56, bar = -size * .3;+ w = Math.max(wn, wd) + size * .2;+ text(n, bx + (w - wn) / 2, bar - size * .12, fs);+ text(d, bx + (w - wd) / 2, bar + size * .62, fs);+ mk('path', { d: `M${bx + size * .04} ${bar}H${bx + w - size * .04}`, stroke: fill, 'stroke-width': lw, 'stroke-linecap': 'round' }, inner);+ } else { w = textW(p.r, size); text(p.r, x0 + size * .56, 0, size); }+ mk('path', { d: `M${x0} ${mid}L${x0 + size * .1} ${mid - size * .06}L${x0 + size * .27} ${bot}L${x0 + size * .45} ${top}H${x0 + size * .56 + w + size * .06}`,+ fill: 'none', stroke: fill, 'stroke-width': lw, 'stroke-linejoin': 'round', 'stroke-linecap': 'round' }, inner);+ cx = x0 + size * .56 + w + size * .1;+ } else if (p.sup !== undefined) {+ cx += text(p.sup, cx + size * .03, -size * .45, size * .62) + size * .06;+ } else if (p.ov !== undefined) {+ const w = text(p.ov, cx, 0, size);+ rule(cx + size * .04, cx + w - size * .02, -size * .8);+ cx += w;+ }+ }+ const dx = anchor === 'middle' ? -cx / 2 : anchor === 'end' ? -cx : 0;+ inner.setAttribute('transform', `translate(${dx},0)`);+ g._w = cx;+ return g;+}+// Pill-shaped number token, centred on (x, y).+function chip(parent, parts, color, { x = 0, y = 0, o = 1, s = 1, size = 34 } = {}) {+ const g = G(parent, { x, y, o, s });+ const rect = mk('rect', {}, g);+ const m = M(g, parts, { size, y: size * .3 });+ const w = Math.max(m._w + 36, 64), h = size * (parts.some(p => p.f) ? 1.75 : 1.45);+ for (const [k, v] of Object.entries({ x: -w / 2, y: -h / 2, width: w, height: h, rx: h / 2, fill: COL.board, stroke: color, 'stroke-width': 2.5 })) rect.setAttribute(k, v);+ g._rect = rect;+ return g;+}+// A row of math tokens laid out left to right. Items: string | parts array | { t, fill }.+// Each token is centred on its own x, so it can move alone (swaps, sliding parentheses). Spacing comes from the strings.+function tokens(parent, items, { x = 0, y = 0, size = 44, fill = COL.chalk, anchor = 'start', o = 1 } = {}) {+ const els = items.map(it => {+ const spec = it && it.t !== undefined ? it : { t: it };+ return M(parent, [].concat(spec.t), { size, fill: spec.fill || fill, o });+ });+ return layRow(els, { x, y, size, anchor }, e => put(e, { x: e._px, y }));+}+// Place a row's tokens side by side. Each token keeps its planned centre in _px, so later steps+// can be planned before earlier tweens have run.+function layRow(els, { x, y, size, anchor }, move) {+ const total = els.reduce((a, e) => a + e._w, 0);+ let cx = anchor === 'middle' ? x - total / 2 : anchor === 'end' ? x - total : x;+ for (const e of els) { e._px = cx + e._w / 2; move(e); cx += e._w; }+ return Object.assign(els, { w: total, x, y, size, anchor });+}+// One simplification step: box tokens i..j, shrink them into a single result token, then close the gap.+// Returns the new row. live = true runs on the question clock (inside ask) instead of the lesson clock.+function collapse(row, i, j, parts, t0, { color = COL.task, fill = COL.chalk, live = false } = {}) {+ const run = live ? fx : tw, p = row[0].parentNode, { size, y } = row;+ const left = row[i]._px - row[i]._w / 2, right = row[j]._px + row[j]._w / 2;+ const box = put(mk('rect', { rx: 10, fill: 'none', stroke: color, 'stroke-width': 3 }, p),+ { o: 0, a_x: left - 8, a_y: y - size * .95, a_width: right - left + 16, a_height: size * 1.3 });+ run(box, { o: 1 }, t0, .3);+ run(box, { o: 0 }, t0 + 1.2, .3);+ const res = M(p, parts, { size, fill, o: 0, x: (left + right) / 2, y });+ for (let k = i; k <= j; k++) run(row[k], { o: 0, s: .6 }, t0 + .8, .35);+ run(res, { o: 1 }, t0 + .95, .35);+ const next = [...row.slice(0, i), res, ...row.slice(j + 1)];+ return layRow(next, row, e => run(e, { x: e._px }, t0 + 1.3, .5));+}+// Vertical number line at x; Yf maps a value to its y. Labels sit on the left.+function vAxis(p, { x, Yf, lo, hi, step = 1, t0 = .1, unit = '' }) {+ draw(path(p, `M${x} ${Yf(lo - .5)}V${Yf(hi + .5)}`, { stroke: COL.chalk, 'stroke-width': 3 }, { d: 0 }), t0, .8);+ for (let v = lo; v <= hi; v += step) {+ const g = G(p, { o: 0 });+ path(g, `M${x - 9} ${Yf(v)}H${x + 9}`, { stroke: COL.dim, 'stroke-width': 2.5 });+ T(g, num(v) + unit, { x: x - 46, y: Yf(v) + 9, size: 24, fill: v === 0 ? COL.chalk : COL.dim, font: MATH, anchor: 'end' });+ show(g, t0 + .2 + Math.abs(v - lo) * .02);+ }+}+// Thermometer from lo (bottom) to hi (top). set(v, t0, run) moves the column; run = tw (lesson) or fx (answer).+function thermometer(p, { x = 800, bottom = 600, top = 200, lo = -10, hi = 15, step = 5, value = 0, color = COL.nat } = {}) {+ const Yt = v => bottom - (v - lo) / (hi - lo) * (bottom - top), bulb = bottom + 32, g = G(p);+ mk('rect', { x: x - 18, y: top - 24, width: 36, height: bulb - top + 24, rx: 18, fill: COL.board, stroke: COL.dim, 'stroke-width': 2.5 }, g);+ mk('circle', { cx: x, cy: bulb, r: 26, fill: color }, g);+ const merc = put(mk('rect', { x: x - 9, width: 18, rx: 9, fill: color }, g), { a_y: Yt(value), a_height: bulb - Yt(value) });+ for (let v = lo; v <= hi; v += step) {+ path(g, `M${x - 30} ${Yt(v)}H${x - 18}`, { stroke: COL.dim, 'stroke-width': 2 });+ T(g, `${num(v)}°`, { x: x - 40, y: Yt(v) + 9, size: 24, fill: v === 0 ? COL.chalk : COL.dim, font: MATH, anchor: 'end' });+ }+ return { g, merc, Yt, set: (v, t0, run = tw, dur = 1.2) => run(merc, { a_y: Yt(v), a_height: bulb - Yt(v) }, t0, dur) };+}+/* ---------- fractions: rows with strikable parts, bars and brackets ---------- */+// A row of fractions and symbols whose numerators and denominators can be struck out one by one.+// items: { f: [n, d], fill } | 'symbol text'. The fraction bars sit on y.+function fracRow(p, items, { x = 800, y = 300, size = 60, anchor = 'middle', o = 0 } = {}) {+ const fs = size * .8, g = G(p, { o });+ const els = items.map(it => {+ if (typeof it === 'string') {+ const w = textW(it, size);+ return { w, draw(cx) { this.cx = cx; T(g, it, { x: cx, y: y + size * .33, size, font: MATH, fill: COL.chalk, anchor: 'middle' }); } };+ }+ const [n, d] = it.f.map(String), w = Math.max(textW(n, fs), textW(d, fs)) + size * .35, fill = it.fill || COL.chalk;+ return { w, n, d, draw(cx) {+ this.cx = cx;+ path(g, `M${cx - w / 2 + 4} ${y}H${cx + w / 2 - 4}`, { stroke: fill, 'stroke-width': size * .055 });+ this.num = T(g, n, { x: cx, y: y - size * .18, size: fs, font: MATH, fill, anchor: 'middle' });+ this.den = T(g, d, { x: cx, y: y + size * .78, size: fs, font: MATH, fill, anchor: 'middle' });+ } };+ });+ const total = els.reduce((a, e) => a + e.w, 0);+ let cx = anchor === 'middle' ? x - total / 2 : x;+ for (const e of els) { e.draw(cx + e.w / 2); cx += e.w; }+ return Object.assign(els, { g, y, size, x0: anchor === 'middle' ? x - total / 2 : x, w: total });+}+// Strike the numerator ('num') or denominator ('den') of fraction k and write its reduced value beside it.+function reduce(row, k, part, value, color, t0, run = tw) {+ const e = row[k], { y, size } = row, top = part === 'num';+ const cy = top ? y - size * .42 : y + size * .52, g = row.g;+ const slash = path(g, `M${e.cx - size * .28} ${cy + size * .3}L${e.cx + size * .28} ${cy - size * .3}`, { stroke: color, 'stroke-width': 3.5 }, { d: 0 });+ const nv = T(g, String(value), { x: e.cx + size * .02, y: top ? y - size * .92 : y + size * 1.36, size: size * .5, font: MATH, fill: color, anchor: 'middle', o: 0 });+ run(slash, { d: 1 }, t0, .4); run(nv, { o: 1 }, t0 + .3, .4);+ run(e[part], { o: .45 }, t0 + .3, .4);+}+function rect(p, x, y, w, h, fill, o = 0, stroke = 'none') {+ return put(mk('rect', { x, y, width: w, height: h, fill, stroke, 'stroke-width': 2.5 }, p), { o });+}+function bracketH(p, x1, x2, y, label, color, t0) {+ draw(path(p, `M${x1} ${y - 10}V${y}H${x2}V${y - 10}`, { stroke: color, 'stroke-width': 3 }, { d: 0 }), t0, .5);+ show(T(p, label, { x: (x1 + x2) / 2, y: y + 32, size: 26, fill: color, font: MATH, anchor: 'middle', o: 0 }), t0 + .3);+}++/* ---------- decimal point that hops between digits (ch10, ch20) ---------- */+// Digits in evenly spaced slots with a decimal point that can hop between them.+// places = digits after the point (0 = point at the far right, hidden).+function pointRow(p, digits, x, y, places, { size = 72, fill = COL.chalk, sign = '' } = {}) {+ const g = G(p, { o: 0 }), w = size * .7, n = digits.length, x0 = x - n * w / 2;+ if (sign) T(g, sign, { x: x0 - w * .6, y, size, fill, font: MATH, anchor: 'middle' });+ const ds = [...digits].map((c, i) => T(g, c, { x: x0 + i * w + w / 2, y, size, fill, font: MATH, anchor: 'middle' }));+ const px = k => x0 + (n - k) * w;+ const dot = mk('circle', { r: size * .065, fill: COL.task }, g);+ put(dot, { x: px(places), y: y - size * .02, o: places ? 1 : 0 });+ const trail = path(g, '', { stroke: COL.task, 'stroke-width': 2.5, 'stroke-dasharray': '5 6' });+ return { g, ds, dot, px, w,+ hop(from, to, t0, run = tw, dur = .55) {+ const steps = Math.abs(to - from);+ run(dot, { o: 1 }, t0, .2);+ let d = '';+ for (let k = 0; k < steps; k++) {+ const a = px(from + Math.sign(to - from) * k), b = px(from + Math.sign(to - from) * (k + 1));+ d += `M${a} ${y - 10}Q${(a + b) / 2} ${y - size * .9} ${b} ${y - 10}`;+ }+ trail.setAttribute('d', d);+ put(trail, { o: 0 }); run(trail, { o: .9 }, t0 + steps * dur, .3);+ (run === tw ? prog : fxp)(q => {+ const s = q * steps, k = Math.min(steps - 1, Math.floor(s)), f = s - k;+ const a = px(from + Math.sign(to - from) * k), b = px(from + Math.sign(to - from) * (k + 1));+ put(dot, { x: a + (b - a) * f, y: y - size * .02 - Math.sin(Math.PI * f) * size * .7 });+ }, t0, steps * dur, lin);+ } };+}++/* ---------- balance scale for equations (ch24, ch25) ---------- */+// A balance scale. Its pans hang from the beam ends; tilt(deg, t0) rocks it (positive: left side down).+function balance(p, { x = 800, y = 330, L = 300 } = {}) {+ const g = G(p, { o: 0 });+ path(g, `M${x} ${y}L${x - 50} ${y + 330}H${x + 50}Z`, { stroke: COL.dim, 'stroke-width': 3, fill: mix(COL.board, COL.dim, .15) });+ const beam = G(g, { x, y });+ path(beam, `M${-L} 0H${L}`, { stroke: COL.chalk, 'stroke-width': 6 });+ mk('circle', { r: 10, fill: COL.chalk }, beam);+ const pan = side => {+ const pg = G(g, { x: x + side * L, y });+ path(pg, 'M0 0L-90 110M0 0L90 110', { stroke: COL.dim, 'stroke-width': 2 });+ path(pg, 'M-110 110Q0 150 110 110Z', { stroke: side < 0 ? COL.whole : COL.nat, 'stroke-width': 3, fill: mix(COL.board, side < 0 ? COL.whole : COL.nat, .2) });+ return pg;+ };+ const Lp = pan(-1), Rp = pan(1);+ let angle = 0;+ const place = a => {+ const r = a * Math.PI / 180, dx = L * Math.cos(r), dy = L * Math.sin(r);+ put(beam, { r: -a }); put(Lp, { x: x - dx, y: y + dy }); put(Rp, { x: x + dx, y: y - dy });+ };+ return {+ g, L: Lp, R: Rp,+ // Content sits on a pan: text or math at (0, 90) in pan coordinates.+ load(side, parts, color, t0, size = 44) { const e = M(side < 0 ? Lp : Rp, parts, { y: 96, size, fill: color, o: 0 }); show(e, t0); return e; },+ tilt(a, t0, run = prog) { const from = angle; angle = a; run(q => place(from + (a - from) * back(q)), t0, .9); },+ };+}+/* ---------- algebra tiles (ch23, ch25) ---------- */+const XL = 120, UN = 30; // length of x, size of 1+const TS = { x2: [XL, XL, COL.real], x: [UN, XL, COL.whole], y: [UN, 90, COL.nat], one: [UN, UN, COL.int] };+function atile(p, kind, x, y, neg = false, o = 0) {+ const [w, h, c] = TS[kind], g = G(p, { x, y, o, s: o ? 1 : .6 });+ mk('rect', { x: -w / 2, y: -h / 2, width: w, height: h, rx: 5, fill: neg ? COL.board : mix(COL.board, c, .55), stroke: neg ? COL.bad : c, 'stroke-width': neg ? 3.5 : 2.5, 'stroke-dasharray': neg ? '7 5' : '' }, g);+ g.kind = kind; g.neg = neg;+ return g;+}+const popIn = (els, t0, step = .08) => els.forEach((e, i) => tw(e, { o: 1, s: 1 }, t0 + i * step, .35, back));+// n tiles of a kind in a row starting at x.+const tileRow = (p, kind, n, x, y, neg = false, gap = 12) => Array.from({ length: n }, (_, i) => atile(p, kind, x + i * (TS[kind][0] + gap), y, neg));+// Pair each negative tile with a positive one: they move together and vanish.+function cancel(pos, negs, t0) {+ negs.forEach((n, i) => {+ const a = pos[i];+ tw(n, { x: st(a).x, y: st(a).y }, t0 + i * .3, .6);+ tw(n, { o: 0, s: .5 }, t0 + i * .3 + .7, .3); tw(a, { o: 0, s: .5 }, t0 + i * .3 + .7, .3);+ });+}+/* ---------- inequality graphs (ch26, ch27) ---------- */+// Solution ray on the number line: endpoint v, closed or open circle, dir +1 (right) or −1 (left).+function ray(p, v, closed, dir, t0, color = COL.task, run = tw) {+ const end = X(dir > 0 ? 5.7 : -5.7), g = G(p, { o: 1 });+ const line = path(g, `M${X(v)} ${Y0}H${end}`, { stroke: color, 'stroke-width': 7 }, { d: 0 });+ const head = path(g, `M${end - 18 * dir} ${Y0 - 13}L${end} ${Y0}L${end - 18 * dir} ${Y0 + 13}`, { stroke: color, 'stroke-width': 6 }, { o: 0 });+ const dot = G(g, { x: X(v), y: Y0, s: 0, o: 0 });+ mk('circle', { r: 13, fill: closed ? color : COL.board, stroke: color, 'stroke-width': 4 }, dot);+ run(dot, { s: 1, o: 1 }, t0, .4, back);+ run(line, { d: 1 }, t0 + .3, .8); run(head, { o: 1 }, t0 + 1, .2);+ return g;+}+// Segment between a and b on the number line, each end open or closed.+function segment(p, a, b, ca, cb, t0, color = COL.task, run = tw) {+ const g = G(p, { o: 1 });+ const line = path(g, `M${X(a)} ${Y0}H${X(b)}`, { stroke: color, 'stroke-width': 7 }, { d: 0 });+ const ends = [[a, ca], [b, cb]].map(([v, c]) => {+ const d = G(g, { x: X(v), y: Y0, s: 0, o: 0 });+ mk('circle', { r: 13, fill: c ? color : COL.board, stroke: color, 'stroke-width': 4 }, d);+ run(d, { s: 1, o: 1 }, t0, .4, back);+ return d;+ });+ run(line, { d: 1 }, t0 + .3, .8);+ g.parentNode.appendChild(g); ends.forEach(e => g.appendChild(e));+ return g;+}+/* ---------- equation steps (ch25 onward) ---------- */+// One line of an equation or inequality with its sign at xEq, so a column of steps lines up. note: grey hint on the right.+function eqLine(p, L, R, y, t0, { xEq = 760, fill = COL.chalk, size = 50, note, sym = '=', symFill, noteX = 1180 } = {}) {+ const g = G(p, { o: 0 });+ M(g, [].concat(L), { x: xEq - size * .6, y, size, fill, anchor: 'end' });+ M(g, [sym], { x: xEq, y, size, fill: symFill || fill });+ M(g, [].concat(R), { x: xEq + size * .6, y, size, fill, anchor: 'start' });+ if (note) T(g, note, { x: noteX, y: y - 8, size: 26, fill: COL.task, weight: 600 });+ show(g, t0);+ return g;+}+/* ---------- data on a number line: dot plots (unit 7) ---------- */+// Axis for data from lo to hi drawn between x0 and x1 at baseline y; every: label every n-th tick.+// shape 'x' draws line-plot crosses instead of dots.+// Returns D: D.V(value) -> x; D.dot(v, color, t0) stacks a dot above v; D.mark(v, color, t0, label) is a+// balance triangle under the axis that can slide with D.slide(mark, v, t0).+function dataLine(p, { lo, hi, x0 = 200, x1 = 1400, y = 600, step = 1, every = 1, t0 = .1, r = 13, size = 22, shape = 'dot' }) {+ const V = v => x0 + (v - lo) / (hi - lo) * (x1 - x0), g = G(p, { o: 0 });+ path(g, `M${x0 - 24} ${y}H${x1 + 24}`, { stroke: COL.dim, 'stroke-width': 3 });+ for (let v = lo, i = 0; v <= hi + 1e-9; v += step, i++) {+ path(g, `M${V(v)} ${y - 7}V${y + 7}`, { stroke: COL.dim, 'stroke-width': 2 });+ if (i % every === 0) T(g, num(+v.toFixed(6)), { x: V(v), y: y + 26 + size, size, fill: COL.dim, font: MATH, anchor: 'middle' });+ }+ show(g, t0);+ const D = {+ g, V, y, r, count: {},+ top: v => y - 6 - r - ((D.count[v] || 1) - 1) * (2 * r + 5),+ dot(v, color, t0, { run = tw, into = p, from } = {}) {+ D.count[v] = (D.count[v] || 0) + 1;+ let d;+ if (shape === 'x') { d = G(into); path(d, `M${-r * .75} ${-r * .75}L${r * .75} ${r * .75}M${r * .75} ${-r * .75}L${-r * .75} ${r * .75}`, { stroke: color, 'stroke-width': 5 }); }+ else d = mk('circle', { r, fill: color, stroke: COL.board, 'stroke-width': 2 }, into);+ put(d, { x: V(v), y: D.top(v), s: 0, o: 0 });+ if (from !== undefined) { put(d, { y: from, s: 1 }); run(d, { o: 1 }, t0, .2); run(d, { y: D.top(v) }, t0, .7, back); }+ else run(d, { s: 1, o: 1 }, t0, .45, back);+ return d;+ },+ dots: (vals, color, t0, gap = .15, opts) => vals.map((v, i) => D.dot(v, color, t0 + i * gap, opts)),+ mark(v, color, t0, label, { run = tw, into = p } = {}) {+ const m = G(into, { x: V(v), y, o: 0 });+ path(m, 'M0 4L-17 30H17Z', { fill: color, stroke: COL.board, 'stroke-width': 2 });+ if (label) T(m, label, { y: 64 + size, size: 24, fill: color, weight: 600, anchor: 'middle' });+ run(m, { o: 1 }, t0, .4);+ return m;+ },+ slide: (m, v, t0, run = tw, dur = 1.2) => run(m, { x: V(v) }, t0, dur),+ // Bracket above the data from a to b at height yb, with a label.+ span(a, b, yb, label, color, t0, { run = tw, into = p } = {}) {+ const g = G(into), l = path(g, `M${V(a)} ${yb + 12}V${yb}H${V(b)}V${yb + 12}`, { stroke: color, 'stroke-width': 3 }, { d: 0 });+ run(l, { d: 1 }, t0, .6);+ const t = M(g, [label], { x: (V(a) + V(b)) / 2, y: yb - 14, size: 28, fill: color, o: 0 });+ run(t, { o: 1 }, t0 + .4, .4);+ return g;+ },+ };+ return D;+}+/* ---------- chance: number cubes, coins, spinners (unit 7) ---------- */+// A number cube face showing n pips, centred on (x, y).+const PIPS = { 1: [[0, 0]], 2: [[-1, -1], [1, 1]], 3: [[-1, -1], [0, 0], [1, 1]], 4: [[-1, -1], [1, -1], [-1, 1], [1, 1]],+ 5: [[-1, -1], [1, -1], [0, 0], [-1, 1], [1, 1]], 6: [[-1, -1], [1, -1], [-1, 0], [1, 0], [-1, 1], [1, 1]] };+function die(p, n, x, y, s = 96, o = 0) {+ const g = G(p, { x, y, o, s: o ? 1 : .6 });+ g._box = mk('rect', { x: -s / 2, y: -s / 2, width: s, height: s, rx: s * .18, fill: mix(COL.board, COL.chalk, .1), stroke: COL.chalk, 'stroke-width': 3 }, g);+ PIPS[n].forEach(([a, b]) => mk('circle', { cx: a * s * .26, cy: b * s * .26, r: s * .085, fill: COL.chalk }, g));+ return g;+}+// Spinner with equal sections; pointer starts straight up. land(k) is the rotation that points at section k.+const SPIN = [COL.whole, COL.nat, COL.int, COL.whole, COL.irr, COL.nat, COL.whole, COL.int];+function spinner(p, cx, cy, r, t0, cols = SPIN) {+ const g = G(p, { x: cx, y: cy, o: 0 }), n = cols.length, secs = [];+ cols.forEach((c, i) => {+ const a1 = (-90 + i * 360 / n) * Math.PI / 180, a2 = (-90 + (i + 1) * 360 / n) * Math.PI / 180;+ secs.push(path(g, `M0 0L${r * Math.cos(a1)} ${r * Math.sin(a1)}A${r} ${r} 0 0 1 ${r * Math.cos(a2)} ${r * Math.sin(a2)}Z`,+ { fill: mix(COL.board, c, .7), stroke: COL.board, 'stroke-width': 3 }));+ });+ mk('circle', { r, fill: 'none', stroke: COL.chalk, 'stroke-width': 3 }, g);+ const ptr = G(g);+ path(ptr, `M0 ${r * .12}V${-r * .78}M-14 ${-r * .66}L0 ${-r * .8}L14 ${-r * .66}`, { stroke: COL.chalk, 'stroke-width': 7 });+ mk('circle', { r: 12, fill: COL.chalk }, g);+ show(g, t0);+ return { g, secs, ptr, land: k => (k + .5) * 360 / n };+}+// Outline some spinner sections: a bright border that fades in.+function outline(p, sp, ks, color, t0, run = tw) {+ return ks.map(k => { const e = sp.secs[k].cloneNode(); e.setAttribute('fill', 'none'); e.setAttribute('stroke', color); e.setAttribute('stroke-width', 7); sp.g.insertBefore(e, sp.ptr); put(e, { o: 0 }); run(e, { o: 1 }, t0, .4); return e; });+}+// A coin face.+function coin(p, side, x, y, t0, r = 34, run = tw) {+ const g = G(p, { x, y, s: .5, o: 0 });+ mk('circle', { r, fill: mix(COL.board, side === 'H' ? COL.int : COL.rat, .5), stroke: side === 'H' ? COL.int : COL.rat, 'stroke-width': 3 }, g);+ T(g, side, { y: r * .36, size: r, fill: COL.chalk, weight: 700, anchor: 'middle' });+ run(g, { s: 1, o: 1 }, t0, .45, back);+ return g;+}+/* ---------- scaled axes for data and real-world graphs (ch41 onward) ---------- */+// Axes with a scale on each; returns value -> pixel maps. ybreak draws a zigzag when y does not start at 0.+function axes(p, { x0, y0, w, h, xs: [xlo, xhi, xst], ys: [ylo, yhi, yst], xl, yl, t0, ybreak }) {+ const PX = v => x0 + (v - xlo) / (xhi - xlo) * w, PY = v => y0 - (v - ylo) / (yhi - ylo) * h, g = G(p, { o: 0 });+ let d = '';+ for (let v = xlo + xst; v <= xhi + 1e-9; v += xst) d += `M${PX(v)} ${y0}V${y0 - h}`;+ for (let v = ylo + yst; v <= yhi + 1e-9; v += yst) d += `M${x0} ${PY(v)}H${x0 + w}`;+ mk('path', { d, stroke: COL.chalk, 'stroke-opacity': .1, 'stroke-width': 1.5, fill: 'none' }, g);+ path(g, `M${x0} ${y0 - h - 20}V${y0}H${x0 + w + 20}`, { stroke: COL.chalk, 'stroke-width': 3 });+ if (ybreak) path(g, `M${x0 - 10} ${y0 - 22}L${x0 + 10} ${y0 - 30}M${x0 - 10} ${y0 - 34}L${x0 + 10} ${y0 - 42}`, { stroke: COL.chalk, 'stroke-width': 3 });+ for (let v = xlo; v <= xhi + 1e-9; v += xst) T(g, String(v), { x: PX(v), y: y0 + 30, size: 20, fill: COL.dim, font: MATH, anchor: 'middle' });+ for (let v = ylo; v <= yhi + 1e-9; v += yst) T(g, String(v), { x: x0 - 14, y: PY(v) + 7, size: 20, fill: COL.dim, font: MATH, anchor: 'end' });+ T(g, xl, { x: x0 + w / 2, y: y0 + 66, size: 24, fill: COL.dim, anchor: 'middle' });+ T(g, yl, { x: x0, y: y0 - h - 36, size: 24, fill: COL.dim, anchor: 'middle' });+ show(g, t0);+ return { PX, PY };+}+/* ---------- area grids for multiplying and factoring polynomials (ch51 onward) ---------- */+// Area grid from (x0, y0): column widths ws, row heights hs, factor terms along the top and the left side.+function areaGrid(p, x0, y0, ws, hs, colLab, rowLab, t0, { size = 40 } = {}) {+ const xs = [x0], ys = [y0];+ ws.forEach(w => xs.push(xs.at(-1) + w)); hs.forEach(h => ys.push(ys.at(-1) + h));+ let d = '';+ xs.forEach(x => { d += `M${x} ${y0}V${ys.at(-1)}`; }); ys.forEach(y => { d += `M${x0} ${y}H${xs.at(-1)}`; });+ draw(path(p, d, { stroke: COL.chalk, 'stroke-width': 3 }, { d: 0 }), t0, .9);+ colLab.forEach((l, j) => show(M(p, [].concat(l), { x: (xs[j] + xs[j + 1]) / 2, y: y0 - 22, size, fill: COL.whole, o: 0 }), t0 + .3 + j * .15));+ rowLab.forEach((l, i) => show(M(p, [].concat(l), { x: x0 - 24, y: (ys[i] + ys[i + 1]) / 2 + size * .35, size, fill: COL.nat, anchor: 'end', o: 0 }), t0 + .3 + i * .15));+ const box = (i, j, pad) => ({ x: xs[j] + pad, y: ys[i] + pad, width: xs[j + 1] - xs[j] - 2 * pad, height: ys[i + 1] - ys[i] - 2 * pad });+ return {+ xs, ys,+ cell(i, j, parts, t0, { fill = COL.chalk, tint, run = tw, into = p } = {}) {+ if (tint) { const r = put(mk('rect', { ...box(i, j, 3), fill: tint }, into), { o: 0 }); into.insertBefore(r, into.firstChild); run(r, { o: .3 }, t0, .4); }+ const e = M(into, [].concat(parts), { x: (xs[j] + xs[j + 1]) / 2, y: (ys[i] + ys[i + 1]) / 2 + size * .35, size, fill, o: 0, s: .6 });+ run(e, { o: 1, s: 1 }, t0, .4, back);+ return e;+ },+ ring(i, j, color, t0, run = tw, into = p) { const r = put(mk('rect', { ...box(i, j, 8), rx: 12, fill: 'none', stroke: color, 'stroke-width': 4.5 }, into), { o: 0 }); run(r, { o: 1 }, t0, .3); return r; },+ };+}+// A curved arrow from (x1, y1) to (x2, y2) bending up (h < 0) or down (h > 0).+function arc(p, x1, y1, x2, y2, h, color, t0, run = tw) {+ const mx = (x1 + x2) / 2, l = path(p, `M${x1} ${y1}Q${mx} ${y1 + h} ${x2} ${y2}`, { stroke: color, 'stroke-width': 3.5 }, { d: 0 });+ run(l, { d: 1 }, t0, .5);+ return l;+}++/* ---------- built-up fractions with math above and below the bar (ch60 onward) ---------- */+// Width of math parts at a size, without leaving anything on the stage.+function mathW(parts, size) { const e = M(scene, [].concat(parts), { size, o: 0 }), w = e._w; e.remove(); return w; }+// A built-up fraction whose top and bottom are math parts (they may hold radicals); bar on y. Returns { g, w, t, b, x0 }.+function frac(p, top, bot, x, y, t0, { size = 56, fill = COL.chalk, anchor = 'start', topFill, botFill } = {}) {+ const g = G(p, { o: 0 });+ const w = Math.max(mathW(top, size), mathW(bot, size)) + size * .3;+ const x0 = anchor === 'middle' ? x - w / 2 : x;+ const t = M(g, [].concat(top), { x: x0 + w / 2, y: y - size * .25, size, fill: topFill || fill });+ const b = M(g, [].concat(bot), { x: x0 + w / 2, y: y + size * 1.05, size, fill: botFill || fill });+ path(g, `M${x0} ${y}H${x0 + w}`, { stroke: fill, 'stroke-width': size * .05 });+ if (t0 !== undefined) show(g, t0);+ return { g, w, t, b, x0 };+}++/* ---------- coordinate plane (unit 6 onward) ---------- */+// Grid centred on the origin at (cx, cy); u pixels per unit; x from x0 to x1, y from y0 to y1.+// Returns { g, PX, PY, u, ... } with helpers to plot points, walk to a point, and draw lines.+// The grid stays in p; marks go into P.layer (set it to the current panel so marks clear with the step) or opts.into.+function plane(p, { cx = 800, cy = 450, u = 50, x0 = -6, x1 = 6, y0 = -6, y1 = 6, t0 = .1, labels = true, step = 1 } = {}) {+ const PX = x => cx + x * u, PY = y => cy - y * u, g = G(p, { o: 0 });+ let d = '';+ for (let x = x0; x <= x1; x++) if (x) d += `M${PX(x)} ${PY(y0)}V${PY(y1)}`;+ for (let y = y0; y <= y1; y++) if (y) d += `M${PX(x0)} ${PY(y)}H${PX(x1)}`;+ mk('path', { d, stroke: COL.chalk, 'stroke-opacity': .1, 'stroke-width': 1.5, fill: 'none' }, g);+ const ax = { stroke: COL.chalk, 'stroke-width': 3 };+ path(g, `M${PX(x0 - .5)} ${cy}H${PX(x1 + .5)}M${PX(x1 + .5) - 14} ${cy - 9}L${PX(x1 + .5)} ${cy}L${PX(x1 + .5) - 14} ${cy + 9}`, ax);+ path(g, `M${cx} ${PY(y0 - .5)}V${PY(y1 + .5)}M${cx - 9} ${PY(y1 + .5) + 14}L${cx} ${PY(y1 + .5)}L${cx + 9} ${PY(y1 + .5) + 14}`, ax);+ T(g, 'x', { x: PX(x1 + .5) + 10, y: cy + 30, size: 28, fill: COL.dim, font: MATH, anchor: 'middle' }).setAttribute('font-style', 'italic');+ T(g, 'y', { x: cx - 26, y: PY(y1 + .5) + 10, size: 28, fill: COL.dim, font: MATH, anchor: 'middle' }).setAttribute('font-style', 'italic');+ if (labels) {+ for (let x = x0; x <= x1; x += step) if (x) T(g, num(x), { x: PX(x), y: cy + 26, size: 18, fill: COL.dim, font: MATH, anchor: 'middle' });+ for (let y = y0; y <= y1; y += step) if (y) T(g, num(y), { x: cx - 12, y: PY(y) + 6, size: 18, fill: COL.dim, font: MATH, anchor: 'end' });+ }+ show(g, t0, .5);+ const P = {+ g, PX, PY, u, cx, cy, x0, x1, y0, y1, layer: null,+ dot(x, y, color, t0, { r = 10, label, run = tw, dx = 14, dy = -14, anchor = 'start', into = P.layer || p, open = false } = {}) {+ const d = G(into, { x: PX(x), y: PY(y), s: 0, o: 0 });+ mk('circle', open ? { r, fill: COL.board, stroke: color, 'stroke-width': 3.5 } : { r, fill: color, stroke: COL.board, 'stroke-width': 2 }, d);+ run(d, { s: 1, o: 1 }, t0, .4, back);+ if (label) { const l = M(into, [label], { x: PX(x) + dx, y: PY(y) + dy, size: 26, fill: color, anchor, o: 0 }); run(l, { o: 1 }, t0 + .2, .3); }+ return d;+ },+ // Walk from the origin: along x, then along y, drawing arrows; then a dot.+ walk(x, y, t0, { cx: colX = COL.whole, cy: colY = COL.nat, run = tw, color = COL.task, label, into = P.layer || p } = {}) {+ const a = path(into, `M${PX(0)} ${PY(0)}H${PX(x)}`, { stroke: colX, 'stroke-width': 5 }, { d: 0 });+ const b = path(into, `M${PX(x)} ${PY(0)}V${PY(y)}`, { stroke: colY, 'stroke-width': 5 }, { d: 0 });+ run(a, { d: 1 }, t0, .3 + Math.abs(x) * .12, lin);+ run(b, { d: 1 }, t0 + .4 + Math.abs(x) * .12, .3 + Math.abs(y) * .12, lin);+ return P.dot(x, y, color, t0 + .8 + (Math.abs(x) + Math.abs(y)) * .12, { run, label, into });+ },+ // Arrow from (xa, ya) to (xb, yb) with an optional label beside its middle.+ arrow(xa, ya, xb, yb, color, t0, { label, run = tw, into = P.layer || p } = {}) {+ const a = [PX(xa), PY(ya)], b = [PX(xb), PY(yb)], L = Math.hypot(b[0] - a[0], b[1] - a[1]), ux = (b[0] - a[0]) / L, uy = (b[1] - a[1]) / L;+ const l = path(into, `M${a[0]} ${a[1]}L${b[0]} ${b[1]}M${b[0] - 12 * ux - 8 * uy} ${b[1] - 12 * uy + 8 * ux}L${b[0]} ${b[1]}L${b[0] - 12 * ux + 8 * uy} ${b[1] - 12 * uy - 8 * ux}`, { stroke: color, 'stroke-width': 4 }, { d: 0 });+ run(l, { d: 1 }, t0, .5);+ if (label !== undefined) {+ const vert = Math.abs(uy) > Math.abs(ux);+ const t = M(into, [label], { x: (a[0] + b[0]) / 2 + (vert ? -24 : 0), y: (a[1] + b[1]) / 2 + (vert ? 9 : -12), size: 26, fill: color, anchor: vert ? 'end' : 'middle', o: 0 });+ run(t, { o: 1 }, t0 + .3, .3);+ }+ return l;+ },+ // One slope step from (x, y): rise first (irr green), then run (real violet).+ stair(x, y, rise, runX, t0, { run = tw, into = P.layer || p, labels = true } = {}) {+ P.arrow(x, y, x, y + rise, COL.irr, t0, { label: labels ? num(rise) : undefined, run, into });+ P.arrow(x, y + rise, x + runX, y + rise, COL.real, t0 + .6, { label: labels ? num(runX) : undefined, run, into });+ },+ // Shade the region where every a·x + b·y ≥ c in the list holds, clipped to the grid.+ region(list, color, t0, { run = tw, into = P.layer || p, o = .22 } = {}) {+ let pts = [[x0, y0], [x1, y0], [x1, y1], [x0, y1]];+ for (const [a, b, c] of list) {+ const f = ([x, y]) => a * x + b * y - c, next = [];+ pts.forEach((v, i) => {+ const w = pts[(i + 1) % pts.length], fv = f(v), fw = f(w);+ if (fv >= 0) next.push(v);+ if (fv * fw < 0) { const t = fv / (fv - fw); next.push([v[0] + t * (w[0] - v[0]), v[1] + t * (w[1] - v[1])]); }+ });+ pts = next;+ }+ const e = path(into, pts.length ? 'M' + pts.map(([x, y]) => `${PX(x)} ${PY(y)}`).join('L') + 'Z' : '', { fill: color, stroke: 'none' }, { o: 0 });+ into.insertBefore(e, into.firstChild);+ run(e, { o }, t0, .6);+ return e;+ },+ half: (a, b, c, color, t0, opts) => P.region([[a, b, c]], color, t0, opts),+ // Graph of y = f(x) for x from xa to xb, drawn on; the part outside the grid's y range is cut off.+ fn(f, xa, xb, color, t0, { run = tw, w = 4, into = P.layer || p, n = 160, dur = 1.2 } = {}) {+ let d = '', pen = false;+ for (let i = 0; i <= n; i++) {+ const x = xa + (xb - xa) * i / n, y = f(x), inside = y >= y0 - .5 && y <= y1 + .5;+ if (inside) { d += `${pen ? 'L' : 'M'}${PX(x).toFixed(1)} ${PY(y).toFixed(1)}`; pen = true; } else pen = false;+ }+ const l = path(into, d, { stroke: color, 'stroke-width': w }, { d: 0 });+ run(l, { d: 1 }, t0, dur);+ return l;+ },+ // Line through two points, extended to the edge of the grid.+ line(xa, ya, xb, yb, color, t0, { run = tw, w = 4, dash, into = P.layer || p } = {}) {+ const dx = xb - xa, dy = yb - ya, ts = [];+ const clip = (t, v, lo, hi) => { if (v >= lo - 1e-9 && v <= hi + 1e-9) ts.push(t); };+ if (dx) { for (const X of [x0, x1]) { const t = (X - xa) / dx; clip(t, ya + t * dy, y0, y1); } }+ if (dy) { for (const Y of [y0, y1]) { const t = (Y - ya) / dy; clip(t, xa + t * dx, x0, x1); } }+ const t1 = Math.min(...ts), t2 = Math.max(...ts);+ // A dashed line fades in: drawing it on would need the dash array for the reveal.+ const l = path(into, `M${PX(xa + t1 * dx)} ${PY(ya + t1 * dy)}L${PX(xa + t2 * dx)} ${PY(ya + t2 * dy)}`, { stroke: color, 'stroke-width': w, ...(dash ? { 'stroke-dasharray': dash } : {}) }, dash ? { o: 0 } : { d: 0 });+ run(l, dash ? { o: 1 } : { d: 1 }, t0, dash ? .6 : 1);+ return l;+ },+ };+ return P;+}+// Question: pick a grid point. ans = [x, y]; no(x, y) explains a wrong pick. Arrows move a cursor, Enter picks.+// test(x, y), when given, accepts any point it approves; ans is then the point Show answer uses.+const pickPoint = (P, ans, yes, no, onRight, test) => (body, api) => {+ const L = qlayer();+ let cur = [0, 0], locked = false;+ const cursor = G(L, { x: P.PX(0), y: P.PY(0) });+ mk('circle', { r: 16, fill: 'none', stroke: COL.task, 'stroke-width': 3 }, cursor);+ let tag = null;+ const moveTo = (x, y) => {+ cur = [Math.max(P.x0, Math.min(P.x1, x)), Math.max(P.y0, Math.min(P.y1, y))];+ put(cursor, { x: P.PX(cur[0]), y: P.PY(cur[1]) });+ tag?.remove();+ tag = M(L, [`(${num(cur[0])}, ${num(cur[1])})`], { x: P.PX(cur[0]) + 22, y: P.PY(cur[1]) - 18, size: 24, fill: COL.task, anchor: 'start' });+ };+ moveTo(0, 0);+ const pick = () => {+ if (locked) return;+ const [x, y] = cur;+ if (test ? test(x, y) : x === ans[0] && y === ans[1]) { P.dot(x, y, COL.good, 0, { run: fx, into: L }); onRight?.(); api.grade(true, typeof yes === 'function' ? yes(x, y) : yes); }+ else { const d = P.dot(x, y, COL.bad, 0, { run: fx, r: 8, into: L }); fx(d, { o: 0 }, 1.2, .4); shakeFx(cursor); api.grade(false, no(x, y)); }+ };+ const hit = mk('rect', { x: P.PX(P.x0 - .5), y: P.PY(P.y1 + .5), width: (P.x1 - P.x0 + 1) * P.u, height: (P.y1 - P.y0 + 1) * P.u, fill: 'transparent' }, L);+ L.insertBefore(hit, L.firstChild);+ hit.style.cursor = 'crosshair';+ hit.addEventListener('click', e => {+ if (locked) return;+ const s = $('stage'), pt = s.createSVGPoint(); pt.x = e.clientX; pt.y = e.clientY;+ const q = pt.matrixTransform(s.getScreenCTM().inverse());+ moveTo(Math.round((q.x - P.cx) / P.u), Math.round((P.cy - q.y) / P.u));+ pick();+ });+ return {+ reveal() { moveTo(...ans); P.dot(ans[0], ans[1], COL.good, 0, { run: fx, into: L }); onRight?.(); return typeof yes === 'function' ? yes(...ans) : yes; },+ lock() { locked = true; },+ hint: [kbd('←'), kbd('↑'), kbd('↓'), kbd('→'), ' move, ', kbd('Enter'), ' choose, or click the grid'],+ key(e) {+ if (locked) return false;+ const d = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, 1], ArrowDown: [0, -1] }[e.key];+ if (d) { moveTo(cur[0] + d[0], cur[1] + d[1]); return true; }+ if (e.key === 'Enter') { pick(); return true; }+ return false;+ },+ };+};+/* ---------- signed numbers: number-line moves and plus/minus tiles ---------- */+const POS = COL.whole, NEG = COL.nat; // positive: blue, negative: coral+// Integer number line from lo to hi with arrows at both ends, drawn into S.line.+function numberLine(t0 = .1, lo = -8, hi = 8) {+ const L = S.line;+ draw(path(L, `M${X(lo - .7)} ${Y0}H${X(hi + .7)}`, { stroke: COL.chalk, 'stroke-width': 3 }, { d: 0 }), t0, .8);+ for (const [x, d] of [[X(hi + .7), 1], [X(lo - .7), -1]]) {+ show(path(L, `M${x - 15 * d} ${Y0 - 10}L${x} ${Y0}L${x - 15 * d} ${Y0 + 10}`, { stroke: COL.chalk, 'stroke-width': 3 }, { o: 0 }), t0 + .7, .3);+ }+ for (let v = lo; v <= hi; v++) show(tick(v), t0 + .2 + Math.abs(v) * .04, .4);+}+// A move along the number line from a to b, drawn as an arrow at height y. run = tw (lesson) or fx (answer).+function move(p, a, b, y, t0, run = tw) {+ const x1 = X(a), x2 = X(b), d = Math.sign(b - a), color = d > 0 ? POS : NEG;+ const dur = .35 + Math.abs(b - a) * .09;+ const line = path(p, `M${x1} ${y}H${x2}`, { stroke: color, 'stroke-width': 5 }, { d: 0 });+ const head = path(p, `M${x2 - 15 * d} ${y - 11}L${x2} ${y}L${x2 - 15 * d} ${y + 11}`, { stroke: color, 'stroke-width': 5 }, { o: 0 });+ const lab = T(p, (d > 0 ? '+' : '−') + Math.abs(b - a), { x: (x1 + x2) / 2, y: y - 16, size: 28, fill: color, font: MATH, anchor: 'middle', o: 0 });+ const drop = path(p, `M${x2} ${y + 12}V${Y0 - 14}`, { stroke: color, 'stroke-width': 2, 'stroke-dasharray': '5 6' }, { o: 0 });+ run(line, { d: 1 }, t0, dur, lin); run(head, { o: 1 }, t0 + dur - .1, .15);+ run(lab, { o: 1 }, t0 + .2, .3); run(drop, { o: .8 }, t0 + dur, .3);+}+function landDot(p, v, t0, color = COL.chalk, run = tw) {+ const g = G(p, { x: X(v), y: Y0, s: 0, o: 0 });+ mk('circle', { r: 12, fill: color, stroke: COL.board, 'stroke-width': 2 }, g);+ run(g, { s: 1, o: 1 }, t0, .45, back);+ return g;+}+function tile(p, sign, x, y, o = 0) {+ const c = sign > 0 ? POS : NEG, g = G(p, { x, y, o, s: o ? 1 : .6 });+ mk('rect', { x: -27, y: -27, width: 54, height: 54, rx: 10, fill: mix(COL.board, c, .45), stroke: c, 'stroke-width': 2.5 }, g);+ M(g, [sign > 0 ? '+' : '−'], { y: 13, size: 40 });+ return g;+}+const tiles = (p, n, sign, x0, y, gap = 70) => Array.from({ length: n }, (_, i) => tile(p, sign, x0 + i * gap, y));+const popAll = (els, t0, step = .08) => els.forEach((e, i) => tw(e, { o: 1, s: 1 }, t0 + i * step, .35, back));+// Circle each plus/minus pair, then let the pairs vanish: they make zero.+function cancelPairs(p, tops, bottoms, t0) {+ tops.forEach((a, i) => {+ const b = bottoms[i], x = st(a).x, y1 = st(a).y, y2 = st(b).y;+ const ring = put(mk('rect', { rx: 18, fill: 'none', stroke: COL.dim, 'stroke-width': 2.5, 'stroke-dasharray': '8 6' }, p),+ { o: 0, a_x: x - 38, a_y: y1 - 38, a_width: 76, a_height: y2 - y1 + 76 });+ tw(ring, { o: 1 }, t0 + i * .2, .3);+ for (const e of [a, b, ring]) tw(e, { o: 0, ...(e === ring ? {} : { s: .5 }) }, t0 + 1.4 + i * .1, .4);+ });+}+function brace(p, a, b, y, label, color, t0) {+ const x1 = X(a), x2 = X(b);+ draw(path(p, `M${x1} ${y - 10}V${y}H${x2}V${y - 10}`, { stroke: color, 'stroke-width': 3 }, { d: 0 }), t0, .6);+ show(T(p, label, { x: (x1 + x2) / 2, y: y + 34, size: 26, fill: color, anchor: 'middle', o: 0 }), t0 + .4);+}++// Inline math for HTML text.+function mathEl(parts, size = 22) {+ const svg = mk('svg', { class: 'm', 'font-weight': 400 }); // widths are measured at normal weight, so a bold prompt must not thicken the math+ const m = M(svg, parts, { size, anchor: 'start', fill: 'currentColor' });+ const top = size * 1.05, h = size * 1.5;+ svg.setAttribute('viewBox', `0 ${-top} ${m._w + 2} ${h}`);+ svg.setAttribute('width', m._w + 2);+ svg.setAttribute('height', h);+ svg.style.verticalAlign = `${-size * .45}px`; // line up the math baseline with the text baseline+ return svg;+}++/* ---------- number map geometry ---------- */+const RINGS = {+ real: { cx: 640, cy: 470, rx: 610, ry: 390, lx: 640, ly: 128 },+ rat: { cx: 500, cy: 480, rx: 400, ry: 320, lx: 500, ly: 202 },+ int: { cx: 500, cy: 510, rx: 300, ry: 250, lx: 500, ly: 302 },+ whole: { cx: 500, cy: 540, rx: 210, ry: 180, lx: 500, ly: 400 },+ nat: { cx: 500, cy: 570, rx: 125, ry: 110, lx: 500, ly: 500 },+ irr: { cx: 1060, cy: 480, rx: 140, ry: 170, lx: 1060, ly: 360 },+};+const CHAIN = { nat: ['nat', 'whole', 'int', 'rat', 'real'], whole: ['whole', 'int', 'rat', 'real'], int: ['int', 'rat', 'real'], rat: ['rat', 'real'], irr: ['irr', 'real'], real: ['real'] };+const ell = r => `M${r.cx} ${r.cy - r.ry}A${r.rx} ${r.ry} 0 1 1 ${r.cx} ${r.cy + r.ry}A${r.rx} ${r.ry} 0 1 1 ${r.cx} ${r.cy - r.ry}`;+const inRing = (k, x, y) => { const r = RINGS[k]; return ((x - r.cx) / r.rx) ** 2 + ((y - r.cy) / r.ry) ** 2 <= 1; };+function regionAt(x, y) {+ for (const k of ['nat', 'whole', 'int', 'rat', 'irr', 'real']) if (inRing(k, x, y)) return k;+ return null;+}+function buildVenn(parent, hidden) {+ const out = {};+ for (const k of ['real', 'rat', 'int', 'whole', 'nat', 'irr']) {+ const r = RINGS[k], g = G(parent);+ const fill = path(g, ell(r), { fill: mix(COL.board, COL[k], k === 'real' ? .1 : .16), stroke: 'none' }, { o: hidden ? 0 : 1 });+ const stroke = path(g, ell(r), { stroke: COL[k], 'stroke-width': 3 }, hidden ? { d: 0, 'a_stroke-width': 3 } : { 'a_stroke-width': 3 });+ const lab = T(g, NAME[k], { x: r.lx, y: r.ly, size: 26, fill: COL[k], weight: 600, anchor: 'middle', o: hidden ? 0 : 1 });+ out[k] = { g, fill, stroke, lab };+ }+ return out;+}++/* ---------- timeline ---------- */+let TW = [];+const io = p => p < .5 ? 4 * p * p * p : 1 - (-2 * p + 2) ** 3 / 2;+const out = p => 1 - (1 - p) ** 3;+const back = p => 1 + 2.2 * (p - 1) ** 3 + 1.2 * (p - 1) ** 2;+const lin = p => p;+function tw(e, to, t0, dur = .6, ease = io) { TW.push({ e, to, t0, dur, ease }); }+function prog(pf, t0, dur, ease = io) { TW.push({ pf, t0, dur, ease }); }+const show = (e, t0, dur = .5) => tw(e, { o: 1 }, t0, dur);+const hide = (e, t0, dur = .5) => tw(e, { o: 0 }, t0, dur);+const draw = (e, t0, dur = .9) => tw(e, { d: 1 }, t0, dur);+const pop = (e, t0) => tw(e, { s: 1, o: 1 }, t0, .45, back);+function pulse(e, t0, k = 1.7) { tw(e, { s: k }, t0, .22, out); tw(e, { s: 1 }, t0 + .22, .4); }+function glow(key, t0) {+ const s = S.ring[key].stroke;+ tw(s, { 'a_stroke-width': 9 }, t0, .22, out); tw(s, { 'a_stroke-width': 3 }, t0 + .25, .5);+}+function glowRun(key, t0) { CHAIN[key].forEach((k, i) => glow(k, t0 + i * .3)); }+function stream(t, str, t0, dur) { prog(q => { t.textContent = str.slice(0, Math.round(q * str.length)); }, t0, dur, lin); }+function mix(a, b, q) {+ const h = c => [1, 3, 5].map(i => parseInt(c.slice(i, i + 2), 16));+ const A = h(a), B = h(b);+ return '#' + A.map((v, i) => Math.round(v + (B[i] - v) * q).toString(16).padStart(2, '0')).join('');+}+// A colour or attribute tween with no starting value in the state starts from the element's attribute.+const fromAttr = (e, k) => k.startsWith('c_') ? e.getAttribute(k.slice(2)) : k.startsWith('a_') ? parseFloat(e.getAttribute(k.slice(2))) : undefined;+function evalTo(t, list = TW) {+ for (const w of list) {+ if (w.done || t < w.t0) continue;+ if (!w.go) { w.go = 1; if (w.e) { const s = st(w.e); w.from = {}; for (const k in w.to) w.from[k] = s[k] ?? fromAttr(w.e, k); } }+ const p = w.dur ? Math.min(1, (t - w.t0) / w.dur) : 1, q = w.ease(p);+ if (w.e) {+ const s = st(w.e);+ for (const k in w.to) s[k] = k.startsWith('c_') ? mix(w.from[k], w.to[k], q) : w.from[k] + (w.to[k] - w.from[k]) * q;+ render(w.e);+ } else w.pf(q);+ if (p >= 1) w.done = 1;+ }+}++/* ---------- scene ---------- */+const scene = document.getElementById('scene');+const S = {};+const AXIS = { o: 800, u: 120 }; // number line: x of 0, pixels per unit; a chapter may change it+const X = v => AXIS.o + AXIS.u * v, Y0 = 610;+const num = v => (v < 0 ? '−' : '') + Math.abs(v);+function reset() {+ scene.replaceChildren();+ for (const k in S) delete S[k];+ Object.assign(S, { dots: {}, tick: {}, rows: [], chips: [], samples: [], list: G(scene), line: G(scene), venn: G(scene) });+}+function tick(v) {+ const g = G(S.line, { o: 0 });+ path(g, `M${X(v)} ${Y0 - 11}V${Y0 + 11}`, { stroke: COL.dim, 'stroke-width': 2.5 });+ T(g, num(v), { x: X(v), y: Y0 + 50, size: 30, fill: COL.dim, font: MATH, anchor: 'middle' });+ return (S.tick[v] = g);+}+function dot(key, v, r = 9, name = v) {+ const g = G(S.line, { x: X(v), y: Y0, s: 0, o: 0 });+ mk('circle', { r, fill: COL[key], stroke: COL.board, 'stroke-width': 2 }, g);+ return (S.dots[name] = g);+}+const arrow = (x, dir) => `M${x - 15 * dir} ${Y0 - 10}L${x} ${Y0}L${x - 15 * dir} ${Y0 + 10}`;+function panel(t0) {+ if (t0 < .5) S.cleared = true; // the old panel fades, or this is the first panel after the title+ if (S.panel) hide(S.panel, t0, .4);+ return (S.panel = G(scene));+}+function header(p, str, t0, x = 1000, y = 170) {+ const h = T(p, str, { x, y, size: 30, fill: COL.dim, weight: 600, o: 0 });+ show(h, t0);+ return h;+}++/* ---------- question effects: run on wall time, independent of the lesson clock ---------- */+let FX = [], clock = 0;+function fx(e, to, delay = 0, dur = .5, ease = io) { FX.push({ e, to, t0: clock + delay, dur, ease }); }+function fxp(pf, delay, dur, ease = io) { FX.push({ pf, t0: clock + delay, dur, ease }); }+function finishFx() { FX.sort((a, b) => a.t0 - b.t0); evalTo(Infinity, FX); FX = []; }+const pulseFx = (e, k = 1.8) => { if (!e) return; fx(e, { s: k }, 0, .22, out); fx(e, { s: 1 }, .22, .45); };+const shakeFx = e => { if (!e) return; const x0 = st(e).x; fxp(q => put(e, { x: x0 + Math.sin(q * Math.PI * 6) * (1 - q) * 12 }), 0, .55, lin); };+const glowFx = (key, delay = 0) => CHAIN[key].forEach((k, i) => {+ const s = S.ring[k].stroke;+ fx(s, { 'a_stroke-width': 9 }, delay + i * .28, .22, out); fx(s, { 'a_stroke-width': 3 }, delay + i * .28 + .25, .5);+});+function popDotFx(key, v, label) {+ const L = S.q || qlayer();+ const g = G(L, { x: X(v), y: Y0, s: 0, o: 0 });+ mk('circle', { r: 7, fill: COL[key], stroke: COL.board, 'stroke-width': 2 }, g);+ fx(g, { s: 1, o: 1 }, 0, .45, back);+ if (label) fx(M(L, label, { x: X(v) + 10, y: Y0 + 56, size: 28, fill: COL[key], o: 0 }), { o: 1 }, .3, .4);+}+function floatText(str, x, y, colr) {+ const t = T(S.q || qlayer(), str, { x, y: y + 14, size: 24, fill: colr, anchor: 'middle', weight: 600, o: 0 });+ fx(t, { o: 1, y }, 0, .5, out);+}+function hopsFx(n) {+ for (let k = 1; k <= -n; k++) {+ const a = X(1 - k), b = X(-k);+ fx(path(S.q, `M${a} ${Y0 - 12}Q${(a + b) / 2} ${Y0 - 84} ${b} ${Y0 - 12}`, { stroke: COL.int, 'stroke-width': 3 }, { d: 0 }), { d: 1 }, (k - 1) * .35, .35, lin);+ }+ floatText(`${-n} steps left of 0`, X(n / 2), Y0 - 100, COL.int);+}++/* ---------- shared answer columns ---------- */+const FAMILIES = ['nat', 'whole', 'int', 'rat', 'irr', 'real'];+const FAM_COLS = FAMILIES.map(k => [k, k === 'int' ? 'Integer' : NAME[k], COL[k]]);+const TF = [['t', 'True', null, 'T'], ['f', 'False', null, 'F']];+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')]);+ if (next) next.onclick = () => { location.href = CHAPTER.next; };+ P.keys = e => e.key === 'Enter' ? ((next ? next.onclick() : restart()), true)+ : (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 ? [home, again, next] : [home, again])]));+ setTimeout(() => mood(guide, 'happy'), 400);+}++/* ---------- in-picture cards ---------- */+const $ = id => document.getElementById(id);+const kbd = s => h('kbd', '', s);+const uiW = (str, size) => { ctx2d.font = `600 ${size}px ${UI}`; return ctx2d.measureText(str).width; };+const RING_KEYS = ['nat', 'whole', 'int', 'rat', 'irr', 'real']; // number keys 1–6 in sorting questions+const SCORE = {}; // question id -> first-attempt {right, total}++function h(tag, cls, kids = []) {+ const e = document.createElement(tag);+ if (cls) e.className = cls;+ for (const k of [].concat(kids)) e.append(k);+ return e;+}+// Rich text: strings, DOM nodes, or $m(...) inline math.+function rich(parts, size = 28) {+ const s = document.createElement('span');+ for (const p of [].concat(parts)) s.append(typeof p === 'string' || p instanceof Node ? p : mathEl(p.m, size));+ return s;+}+function card(pos, cls) {+ const c = h('div', `card ${pos.cls} ${cls}`);+ Object.assign(c.style, { left: pos.x + 'px', top: pos.y + 'px', width: pos.w + 'px' });+ if (pos.maxH) c.style.maxHeight = pos.maxH + 'px';+ $('ui').append(c);+ return c;+}+// The guide: an infinity sign whose two loops are its eyes. Drawn in SVG so it can blink, hop and wobble.+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';+}+function mascotEl(size = 100) {+ const svg = mk('svg', { class: 'mascot', viewBox: '0 0 120 84', width: size, height: size * .7, 'aria-hidden': 'true' });+ const body = mk('g', { class: 'mbody' }, svg);+ const line = { fill: 'none', stroke: COL.chalk, 'stroke-linecap': 'round', 'stroke-linejoin': 'round' };+ mk('path', { d: lemniscate(60, 40, 52, 1.5), ...line, 'stroke-width': 6 }, body);+ const eyes = mk('g', { class: 'eyes' }, body);+ for (const x of [33, 87]) {+ mk('circle', { class: 'pupil', cx: x, cy: 40, r: 6.5, fill: COL.chalk }, eyes);+ mk('path', { class: 'joy', d: `M${x - 7} 43Q${x} 32 ${x + 7} 43`, ...line, 'stroke-width': 4 }, body);+ }+ mk('path', { class: 'smile', d: 'M55 62Q60 67 65 62', ...line, 'stroke-width': 3.5 }, body);+ mk('path', { class: 'flat', d: 'M55 64H65', ...line, 'stroke-width': 3.5 }, body);+ return svg;+}+function mood(el, m) {+ el.classList.remove('happy', 'oops');+ void el.getBoundingClientRect(); // restart the CSS animation+ if (m) el.classList.add(m);+}+// A sequence of questions in one card. Each question: { id, prompt, build(body, api) -> { check?, reveal, lock? } }.+function quiz(pos, qs, done, label = 'Quick check') {+ const c = card(pos, 'quiz');+ let k = 0;+ const show = () => {+ const q = qs[k];+ let first = true, resolved = false;+ const fb = h('div', 'fb'), body = h('div', 'body'), acts = h('div', 'acts');+ const bCheck = h('button', 'btn', ['Check', kbd('Enter')]), bShow = h('button', 'btn quiet', ['Show answer', kbd('S')]);+ const bNext = h('button', 'btn go', [k < qs.length - 1 ? 'Next question' : 'Continue', kbd('Enter')]);+ bShow.hidden = bNext.hidden = true;+ const guide = pos.cls === 'band' || pos.cls === 'side' ? mascotEl(pos.cls === 'band' ? 108 : 70) : null;+ const say = (cls, parts) => { fb.className = 'fb ' + cls; fb.replaceChildren(rich(parts, 24)); fb.style.animation = 'none'; void fb.offsetWidth; fb.style.animation = ''; };+ const resolve = () => {+ resolved = true;+ bCheck.hidden = bShow.hidden = true;+ ctl.lock?.();+ bNext.hidden = false;+ bNext.focus({ preventScroll: true });+ };+ const api = {+ grade(ok, msg, score) {+ if (resolved) return;+ if (first) { SCORE[q.id] = score || { right: +ok, total: 1 }; first = false; }+ say(ok ? 'ok' : 'no', [ok ? 'Correct. ' : 'Not quite. ', ...[].concat(msg || [])]);+ if (guide) {+ mood(guide, ok ? 'happy' : 'oops');+ if (!ok) setTimeout(() => { if (guide.classList.contains('oops')) mood(guide, null); }, 1600);+ }+ if (ok) resolve(); else bShow.hidden = false;+ },+ };+ const ctl = q.build(body, api);+ if (ctl.check) { bCheck.onclick = () => ctl.check(); acts.append(bCheck); }+ acts.append(bShow, bNext);+ bShow.onclick = () => { say('', ['Answer: ', ...[].concat(ctl.reveal())]); resolve(); };+ bNext.onclick = () => { if (k < qs.length - 1) { k++; show(); } else done(); };+ P.keys = e => {+ if (e.key === 'Enter' && resolved) { bNext.click(); return true; }+ if (!resolved && ctl.key?.(e)) return true;+ if (e.key === 'Enter' && !resolved && ctl.check) { bCheck.click(); return true; }+ if ((e.key === 's' || e.key === 'S') && !bShow.hidden) { bShow.click(); return true; }+ return false;+ };+ const kick = label + (qs.length > 1 ? ` ${k + 1} of ${qs.length}` : '');+ const head = h('div', 'head', [h('p', 'kicker', kick), h('p', 'prompt', [rich(q.prompt, pos.cls.startsWith('screen') ? 38 : 28)])]); // match the prompt's type size+ if (ctl.hint) head.append(h('p', 'keys', ['Keys: ', ...ctl.hint]));+ c.replaceChildren(...(guide ? [guide] : []), head, fb, body, acts);+ };+ show();+}+function qlayer() {+ S.q?.remove();+ S.q = G(scene);+ S.q.classList.add('qlayer');+ return S.q;+}+const keyAct = (el, fn) => el.addEventListener('keydown', e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); fn(); } });++/* ---------- question builders ---------- */+// Single answer from buttons; each wrong option has its own explanation.+const choice = (opts, right, yes, no, onRight) => (body, api) => {+ const row = h('div', 'opts');+ const bs = opts.map((o, i) => {+ const b = h('button', 'opt', [kbd(String(i + 1)), rich(o, 32)]);+ b.onclick = () => {+ if (i === right) { b.classList.add('good'); onRight?.(); api.grade(true, yes); }+ else { b.classList.add('bad'); b.disabled = true; api.grade(false, no[i]); }+ };+ row.append(b);+ return b;+ });+ body.append(row);+ return {+ reveal() { bs[right].classList.add('good'); onRight?.(); return yes; },+ lock() { bs.forEach(b => { b.disabled = true; }); },+ key(e) { const b = bs[+e.key - 1]; if (!b || b.disabled) return false; b.click(); return true; },+ };+};+// Tap a point on the stage number line.+const tap = (values, right, yes, no, onRight) => (body, api) => {+ const L = qlayer(), hits = {};+ let locked = false;+ for (const v of values) {+ const g = G(L, { x: X(v), y: Y0 });+ g.classList.add('hit');+ g.setAttribute('tabindex', 0);+ g.setAttribute('role', 'button');+ g.setAttribute('aria-label', `The point ${num(v)}`);+ mk('circle', { r: 30, class: 'ring' }, g);+ const act = () => {+ if (locked) return;+ if (v === right) { g.classList.add('good'); onRight?.(); api.grade(true, yes); }+ else { g.classList.add('bad'); shakeFx(S.dots[v]); api.grade(false, no(v)); }+ };+ g.addEventListener('click', act);+ keyAct(g, act);+ hits[v] = g;+ }+ const gs = values.map(v => hits[v]);+ let cur = -1;+ return {+ reveal() { hits[right].classList.add('good'); onRight?.(); return yes; },+ lock() { locked = true; },+ hint: [kbd('←'), kbd('→'), ' move along the line, ', kbd('Enter'), ' choose'],+ key(e) {+ const d = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0;+ if (!d || locked) return false;+ cur = cur < 0 ? (d > 0 ? 0 : gs.length - 1) : (cur + d + gs.length) % gs.length;+ gs[cur].focus();+ return true;+ },+ };+};+// Tap one token of a stage token row, e.g. the operation to do first. idx: tappable token indexes.+const tapEls = (row, idx, right, yes, no, onRight) => (body, api) => {+ const L = qlayer();+ let locked = false, cur = -1;+ const hits = idx.map(i => {+ const e = row[i], w = e._w + 18, g = G(L, { x: e._px, y: row.y });+ g.classList.add('hit');+ g.setAttribute('tabindex', 0);+ g.setAttribute('role', 'button');+ g.setAttribute('aria-label', e.textContent.trim());+ mk('rect', { class: 'ring', x: -w / 2, y: -row.size * .95, width: w, height: row.size * 1.3, rx: 12 }, g);+ const act = () => {+ if (locked) return;+ if (i === right) { g.classList.add('good'); onRight?.(); api.grade(true, yes); }+ else { g.classList.add('bad'); shakeFx(e); api.grade(false, no(i)); }+ };+ g.addEventListener('click', act);+ keyAct(g, act);+ return g;+ });+ return {+ reveal() { hits[idx.indexOf(right)].classList.add('good'); onRight?.(); return yes; },+ lock() { locked = true; },+ hint: [kbd('←'), kbd('→'), ' move, ', kbd('Enter'), ' choose'],+ key(e) {+ const d = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0;+ if (!d || locked) return false;+ cur = cur < 0 ? (d > 0 ? 0 : hits.length - 1) : (cur + d + hits.length) % hits.length;+ hits[cur].focus();+ return true;+ },+ };+};+// Click one of several stage objects (table cells, bars, small graphs). items: [{ el, box: [x, y, w, h], label }].+const pickEls = (items, right, yes, no, onRight) => (body, api) => {+ const L = qlayer();+ let locked = false, cur = -1;+ const hits = items.map((it, i) => {+ const [x, y, w, hh] = it.box, g = G(L);+ g.classList.add('hit');+ g.setAttribute('tabindex', 0);+ g.setAttribute('role', 'button');+ g.setAttribute('aria-label', it.label);+ mk('rect', { class: 'ring', x, y, width: w, height: hh, rx: 12 }, g);+ const act = () => {+ if (locked) return;+ if (i === right) { g.classList.add('good'); onRight?.(); api.grade(true, yes); }+ else { g.classList.add('bad'); shakeFx(it.el); api.grade(false, no(i)); }+ };+ g.addEventListener('click', act);+ keyAct(g, act);+ return g;+ });+ return {+ reveal() { hits[right].classList.add('good'); onRight?.(); return yes; },+ lock() { locked = true; },+ hint: [kbd('←'), kbd('→'), ' move, ', kbd('Enter'), ' choose, or click'],+ key(e) {+ const d = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0;+ if (!d || locked) return false;+ cur = cur < 0 ? (d > 0 ? 0 : hits.length - 1) : (cur + d + hits.length) % hits.length;+ hits[cur].focus();+ return true;+ },+ };+};+// Rows of toggles. items: { parts, ans: [keys], why }. parts are math parts (strings, F, R) unless text: true,+// where they are rich text (strings and $m(...)). cols: [[key, label, colour?, shortcut?]]. multi: several per row.+const grid = (items, cols, { multi = true, text = false } = {}) => (body, api) => {+ const wrap = h('div', 'grid' + (text ? ' text' : ''));+ const hot = cols.map((c, j) => c[3] || String(j + 1));+ let cur = 0, locked = false;+ const rows = items.map((it, ri) => {+ const opts = h('div', 'opts'), mark = h('div', 'mark'), why = h('div', 'why');+ const bs = cols.map(([key, lab, colr], j) => {+ const b = h('button', 'opt', [kbd(hot[j]), lab]);+ if (colr) b.style.setProperty('--c', colr);+ b.setAttribute('aria-pressed', 'false');+ b.onclick = () => {+ const on = b.getAttribute('aria-pressed') !== 'true';+ if (!multi) bs.forEach(x => x.setAttribute('aria-pressed', 'false'));+ b.setAttribute('aria-pressed', String(on));+ };+ opts.append(b);+ return b;+ });+ const el = h('div', 'row', [h('div', 'num', [text ? rich(it.parts, 26) : mathEl(it.parts, 32)]), opts, mark, why]);+ el.addEventListener('click', () => { cur = ri; showCur(); });+ wrap.append(el);+ const picked = () => cols.filter((c, i) => bs[i].getAttribute('aria-pressed') === 'true').map(c => c[0]);+ return { it, bs, mark, why, picked, el, played: false };+ });+ const single = rows.length === 1;+ const showCur = () => rows.forEach((r, i) => r.el.classList.toggle('cur', !single && !locked && i === cur));+ showCur();+ body.append(wrap);+ const judge = r => {+ const p = r.picked(), ok = p.length === r.it.ans.length && r.it.ans.every(k => p.includes(k));+ r.mark.className = 'mark ' + (ok ? 'good' : 'bad');+ r.mark.textContent = ok ? '✓' : '✗';+ r.why.replaceChildren(ok || single ? '' : rich(r.it.why, 20));+ if (ok && !r.played) { r.played = true; r.it.fx?.(); }+ return ok;+ };+ return {+ check() {+ const right = rows.filter(judge).length;+ const all = right === rows.length;+ api.grade(all, single ? rows[0].it.why : all ? [] : [`${right} of ${rows.length} right. Fix the rows marked ✗ and check again.`], { right, total: rows.length });+ },+ reveal() {+ for (const r of rows) {+ r.bs.forEach((b, i) => b.setAttribute('aria-pressed', String(r.it.ans.includes(cols[i][0]))));+ judge(r);+ if (!single) r.why.replaceChildren(rich(r.it.why, 20));+ }+ return single ? rows[0].it.why : 'the correct choices are now selected.';+ },+ lock() { locked = true; showCur(); rows.forEach(r => r.bs.forEach(b => { b.disabled = true; })); },+ hint: [...(single ? [] : [kbd('↑'), kbd('↓'), ' row, ']), ...(/\d/.test(hot[0]) ? [kbd(hot[0]), '–', kbd(hot[hot.length - 1])] : hot.map(kbd)), ' choose'],+ key(e) {+ if (locked) return false;+ if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') && !single) {+ cur = (cur + (e.key === 'ArrowDown' ? 1 : -1) + rows.length) % rows.length;+ showCur();+ return true;+ }+ const j = hot.findIndex(x => x.toLowerCase() === e.key.toLowerCase());+ if (j < 0) return false;+ rows[cur].bs[j].click();+ if (!multi && cur < rows.length - 1) { cur++; showCur(); }+ return true;+ },+ };+};+// Exact value of a typed answer: integer, decimal, fraction a/b or mixed number "w a/b"; returns [num, den] or null.+// Accepts −, – or - as the sign. Never evaluates the text as code.+function rat(str) {+ const t = String(str).trim().replace(/^[−–]/, '-').replace(/\s+/g, ' ');+ let m = t.match(/^(-?)(\d+)(?:\.(\d+))?$/);+ if (m) { const d = 10 ** (m[3] || '').length; return [(m[1] ? -1 : 1) * (Number(m[2]) * d + Number(m[3] || 0)), d]; }+ m = t.match(/^(-?)(?:(\d+) )?(\d+) ?\/ ?(\d+)$/);+ if (m && Number(m[4]) > 0) { const d = Number(m[4]); return [(m[1] ? -1 : 1) * (Number(m[2] || 0) * d + Number(m[3])), d]; }+ return null;+}+const gcd = (a, b) => { a = Math.abs(a); b = Math.abs(b); while (b) [a, b] = [b, a % b]; return a; };+const lowest = ([n, d]) => gcd(n, d) === 1;+// Fill-in boxes inside math. rows: [{ parts: [math parts and { box: '21' }], why, hint?, fx? }].+// test(values), when given, judges the whole row from the typed numbers (e.g. a factor pair in either order); the boxes' answers are still what Show answer fills in.+// Answers are exact numbers: "−5", "-5", "0.5", "3/4" and "2 1/4" all work, and equal values match ("6/8" = "3/4")+// unless the box has lowest: true. hint is shown after a wrong try, why after a right one.+const blanks = rowsIn => (body, api) => {+ const all = [];+ const rows = rowsIn.map(it => {+ const line = h('div', 'bline'), mark = h('span', 'mark'), why = h('div', 'why');+ let run = [];+ const flush = () => { if (run.length) line.append(mathEl(run, 34)); run = []; };+ const boxes = [];+ for (const p of it.parts) {+ if (p && p.box !== undefined) {+ flush();+ const b = h('input', 'box');+ Object.assign(b, { type: 'text', inputMode: 'decimal', autocomplete: 'off', spellcheck: false });+ b.setAttribute('aria-label', 'Answer');+ b.dataset.ans = p.box;+ if (p.lowest) b.dataset.lowest = '1';+ b.style.width = `${Math.max(2, String(p.box).length) + 2}ch`;+ line.append(b);+ boxes.push(b);+ all.push(b);+ } else run.push(p);+ }+ flush();+ line.append(mark);+ body.append(h('div', 'brow', [line, why]));+ return { it, boxes, mark, why, played: false };+ });+ body.classList.add('blanks');+ const single = rows.length === 1;+ const judge = r => {+ let ok = true;+ if (r.it.test) { // the row is judged as a whole, e.g. two factors in either order+ const vals = r.boxes.map(b => rat(b.value));+ ok = vals.every(Boolean) && !!r.it.test(vals.map(([n, d]) => n / d));+ r.boxes.forEach(b => { b.classList.toggle('good', ok); b.classList.toggle('bad', !ok); });+ } else for (const b of r.boxes) {+ const want = rat(b.dataset.ans), got = rat(b.value);+ const good = !!got && got[0] * want[1] === want[0] * got[1] && (!b.dataset.lowest || lowest(got));+ b.classList.toggle('good', good);+ b.classList.toggle('bad', !good);+ ok = ok && good;+ }+ r.mark.className = 'mark ' + (ok ? 'good' : 'bad');+ r.mark.textContent = ok ? '✓' : '✗';+ r.why.replaceChildren(ok || single ? '' : rich(r.it.hint ?? r.it.why, 20));+ if (ok && !r.played) { r.played = true; r.it.fx?.(); }+ return ok;+ };+ requestAnimationFrame(() => all[0]?.focus({ preventScroll: true }));+ return {+ check() {+ const right = rows.filter(judge).length, done = right === rows.length;+ const msg = single ? (done ? rows[0].it.why : rows[0].it.hint ?? rows[0].it.why)+ : done ? [] : [`${right} of ${rows.length} right. Fix the rows marked ✗ and check again.`];+ api.grade(done, msg, { right, total: rows.length });+ },+ reveal() {+ for (const r of rows) {+ r.boxes.forEach(b => { b.value = b.dataset.ans.replace('-', '−'); }); // shown exactly as authored+ judge(r);+ if (!single) r.why.replaceChildren(rich(r.it.why, 20));+ }+ return single ? rows[0].it.why : 'the correct numbers are filled in.';+ },+ lock() { all.forEach(b => { b.disabled = true; }); },+ hint: [all.some(b => b.dataset.ans.includes('/')) ? 'type numbers like 3/4 or −2 1/4, ' : 'type the number, ', kbd('Tab'), ' next box, ', kbd('Enter'), ' check, ', kbd('Esc'), ' leave the box'],+ };+};+// Drag number chips into the stage number map. items: [parts, smallest ring, explanation].+const slot = (k, n) => {+ if (k === 'real') return [[940, 210], [1000, 760], [820, 800]][n % 3]; // inside Real, outside every other ring+ const r = RINGS[k];+ return [r.lx + [-72, 72, 0][n % 3], r.ly + 50 + 56 * Math.floor(n / 2)];+};+const plain = parts => parts.map(p => typeof p === 'string' ? p : p.ov !== undefined ? p.ov + ' repeating' : p.f ? p.f.join('/') : p.sup !== undefined ? '^' + p.sup : (p.i ? p.i : '') + '√' + (p.r.f ? p.r.f.join('/') : p.r)).join('');+const sorter = (items, trayXY) => (body, api) => {+ const L = qlayer();+ const bg = mk('rect', { width: 1600, height: 900, fill: 'transparent' }, L);+ const svg = $('stage');+ const pt = e => { const p = svg.createSVGPoint(); p.x = e.clientX; p.y = e.clientY; return p.matrixTransform(svg.getScreenCTM().inverse()); };+ let sel = null, drag = null, locked = false;+ const label = c => c.setAttribute('aria-label', `${c.say}, ${c.region ? 'placed in ' + NAME[c.region] : 'not placed'}`);+ const outline = (c, colr, w = 2.5) => { c._rect.setAttribute('stroke', colr); c._rect.setAttribute('stroke-width', w); };+ const choose = c => {+ if (sel) outline(sel, COL.chalk);+ sel = c;+ if (sel) { outline(sel, COL.task, 4); L.append(sel); }+ };+ const select = c => choose(sel === c ? null : c);+ // Number badges next to the ring names, for keys 1–6.+ RING_KEYS.forEach((k, i) => {+ const r = RINGS[k], g = G(L, { x: r.lx - uiW(NAME[k], 26) / 2 - 24, y: r.ly - 9 });+ g.style.pointerEvents = 'none';+ mk('circle', { r: 14, fill: COL.board, stroke: COL[k], 'stroke-width': 1.5 }, g);+ T(g, String(i + 1), { y: 6.5, size: 18, fill: COL[k], anchor: 'middle', weight: 600 });+ });+ const place = (c, x, y) => {+ c.region = regionAt(x, y);+ if (!c.region) [x, y] = c.home;+ put(c, { x, y });+ outline(c, COL.chalk);+ c.querySelector('.mark')?.remove();+ if (sel === c) sel = null;+ label(c);+ };+ const chips = items.map(([parts, answer, why], i) => {+ const [x, y] = trayXY(i);+ const c = chip(L, parts, COL.chalk, { x, y, size: 32 });+ Object.assign(c, { answer, why, home: [x, y], region: null, say: plain(parts) });+ c.classList.add('tok');+ c.setAttribute('tabindex', 0);+ c.setAttribute('role', 'button');+ label(c);+ c.addEventListener('pointerdown', e => {+ if (locked) return;+ e.preventDefault();+ const p = pt(e);+ drag = { dx: p.x - st(c).x, dy: p.y - st(c).y, sx: p.x, sy: p.y, moved: false };+ L.append(c); // re-parent before capturing: moving a node drops its capture+ c.setPointerCapture(e.pointerId);+ });+ c.addEventListener('pointermove', e => {+ if (!drag) return;+ const p = pt(e);+ if (Math.hypot(p.x - drag.sx, p.y - drag.sy) > 6) drag.moved = true;+ if (drag.moved) put(c, { x: p.x - drag.dx, y: p.y - drag.dy });+ });+ c.addEventListener('pointerup', () => {+ if (!drag) return;+ const moved = drag.moved;+ drag = null;+ if (moved) place(c, st(c).x, st(c).y); else select(c);+ });+ keyAct(c, () => { if (!locked) select(c); });+ return c;+ });+ bg.addEventListener('pointerup', e => { if (sel && !locked) { const p = pt(e); place(sel, p.x, p.y); } });+ return {+ check() {+ let right = 0;+ const notes = h('ul');+ for (const c of chips) {+ c.querySelector('.mark')?.remove();+ if (!c.region) { notes.append(h('li', '', `${c.say} is not placed yet.`)); continue; }+ const ok = c.region === c.answer;+ right += ok;+ outline(c, ok ? COL.good : COL.bad, 4);+ if (ok) { pulseFx(c, 1.25); glowFx(c.answer, right * .15); } else shakeFx(c);+ const w = +c._rect.getAttribute('width');+ T(c, ok ? '✓' : '✗', { x: w / 2 + 4, y: -16, size: 26, fill: ok ? COL.good : COL.bad, weight: 700 }).classList.add('mark');+ if (!ok) notes.append(h('li', '', c.region === 'real'+ ? `${c.say}: every real number is rational or irrational, so that space has no numbers of its own.`+ : c.why));+ }+ const all = right === chips.length;+ api.grade(all, all ? [] : [`${right} of ${chips.length} in the right ring.`, notes], { right, total: chips.length });+ },+ reveal() {+ const count = {};+ chips.forEach((c, i) => {+ const n = count[c.answer] = (count[c.answer] ?? -1) + 1;+ const [x, y] = slot(c.answer, n);+ c.region = c.answer;+ c.querySelector('.mark')?.remove();+ outline(c, COL.good, 4);+ fx(c, { x, y }, i * .12, .8);+ });+ return 'every number is now in its smallest ring.';+ },+ lock() { locked = true; choose(null); },+ hint: [kbd('←'), kbd('→'), ' pick a number, ', kbd('1'), '–', kbd('6'), ' choose its ring'],+ key(e) {+ if (locked) return false;+ const d = e.key === 'ArrowRight' || e.key === 'ArrowDown' ? 1 : e.key === 'ArrowLeft' || e.key === 'ArrowUp' ? -1 : 0;+ if (d) {+ const i = sel ? chips.indexOf(sel) : d > 0 ? -1 : 0;+ choose(chips[(i + d + chips.length) % chips.length]);+ return true;+ }+ const ring = RING_KEYS[+e.key - 1];+ if (!ring || !sel) return false;+ const c = sel;+ place(c, ...slot(ring, chips.filter(x => x.region === ring && x !== c).length));+ choose(chips.find(x => !x.region) || null);+ return true;+ },+ };+};++/* ---------- player ---------- */+const P = { i: 0, t: 0, end: 1, playing: false, waiting: false, done: false, started: false, audio: null, afail: false, stall: 0, cleanup: [] };+function runBeat(i) {+ TW = [];+ const b = BEATS[i], tm = TIMINGS[b.id];+ const m = (k, off = 0) => {+ if (!(k in tm.marks)) throw new Error(`${b.id}: missing mark ${k}`);+ return tm.marks[k] + off;+ };+ S.cleared = false;+ b.run(m, tm.dur);+ if (S.cleared && b.lead !== false) leadIn();+ TW.sort((a, c) => a.t0 - c.t0);+ return Math.max(tm.dur, ...TW.map(w => w.t0 + w.dur)) + .6;+}+// A beat that clears the picture must not leave it empty while the narration has started.+// If nothing appears before LEAD_MAX, the opening group (every tween that starts within LEAD_GROUP s of the+// first reveal) moves earlier so it begins at LEAD_AT, just after the old panel has faded. Later steps keep their word timing.+const LEAD_AT = .4, LEAD_MAX = .8, LEAD_GROUP = 1.2;+function leadIn() {+ const reveals = TW.filter(w => {+ if (!w.e) return false;+ const s = st(w.e), to = w.to;+ return (to.o > 0 && s.o === 0) || (to.s > 0 && s.s === 0) || (to.d > 0 && (s.d ?? 1) === 0);+ });+ if (!reveals.length) return;+ const first = Math.min(...reveals.map(w => w.t0));+ if (first <= LEAD_MAX) return;+ for (const w of TW) if (w.t0 >= first && w.t0 < first + LEAD_GROUP) w.t0 -= first - LEAD_AT;+}+function stopAudio() {+ const a = P.audio;+ if (!a) return;+ a.onerror = null; a.pause(); a.removeAttribute('src'); a.load();+ P.audio = null;+}+function clearCards() {+ $('ui').replaceChildren();+ P.cleanup.forEach(f => f());+ P.cleanup = [];+ finishFx();+ P.keys = null;+ S.q?.remove();+ delete S.q;+}+// Rebuild the scene from scratch and fast-forward every earlier beat, so any step starts from its exact picture.+function seek(i, play = P.playing) {+ stopAudio(); clearCards(); reset();+ for (let k = 0; k < i; k++) { runBeat(k); evalTo(Infinity); }+ start(i, play);+}+function start(i, play) {+ stopAudio(); clearCards();+ Object.assign(P, { i, t: 0, waiting: false, done: false, afail: false, stall: 0 });+ P.end = runBeat(i);+ evalTo(0);+ const a = P.audio = new Audio(`audio/${CHAPTER.language || 'en'}/${BEATS[i].id}.mp3`);+ a.preload = 'auto';+ a.onerror = () => { if (P.audio === a) soundFailed(); };+ const b = BEATS[i];+ if (b.ask) b.ask(() => { if (P.i === i) { evalTo(Infinity); start(i + 1, true); } });+ setPlaying(play);+}+function soundFailed() { P.afail = true; $('soundNote').hidden = false; }+function setPlaying(v) {+ P.playing = v;+ const a = P.audio;+ if (!a) return;+ if (v && !P.waiting && !a.ended && !P.afail) a.play().catch(e => { if (P.audio === a && e.name === 'NotAllowedError') soundFailed(); });+ else a.pause();+}+function beatDone() {+ evalTo(Infinity);+ const b = BEATS[P.i];+ if (b.ask) P.waiting = true;+ else if (P.i < BEATS.length - 1) start(P.i + 1, true);+ else { P.done = true; setPlaying(false); }+}+let last = performance.now();+function frame(now) {+ const dt = Math.min(.1, (now - last) / 1000);+ last = now;+ clock += dt;+ if (FX.length) { evalTo(clock, FX); FX = FX.filter(w => !w.done); }+ if (P.playing && !P.waiting && !P.done) {+ const a = P.audio;+ // While the clip plays, its clock drives the picture; before it starts or after it ends, wall time does.+ if (a && !P.afail && !a.ended) {+ if (a.currentTime > 0) { P.t = Math.max(P.t, a.currentTime); P.stall = 0; }+ else if ((P.stall += dt) > 4) soundFailed();+ } else P.t += dt;+ evalTo(P.t);+ if (P.t >= P.end) beatDone();+ }+ ui();+ requestAnimationFrame(frame);+}+let segs = [];+function buildSegs() {+ segs = BEATS.map((b, i) => {+ const s = h('button', 'seg' + (b.ask ? ' ask' : ''), [h('i')]);+ s.style.flex = TIMINGS[b.id].dur + (b.ask ? 12 : 0);+ s.title = b.title;+ s.setAttribute('aria-label', `Go to step ${i + 1}: ${b.title}`);+ s.onclick = () => { hideCover(); seek(i, true); };+ $('segs').append(s);+ return s.firstChild;+ });+}+function ui() {+ segs.forEach((f, k) => { f.style.width = (k < P.i || P.done ? 100 : k > P.i ? 0 : Math.min(100, P.t / P.end * 100)) + '%'; });+ $('frame').classList.toggle('is-playing', P.playing && !P.done && !P.waiting);+ $('frame').classList.toggle('paused', P.started && !P.playing && !P.waiting && !P.done && !BEATS[P.i].ask);+ $('stepName').textContent = `${P.i + 1} / ${BEATS.length} ${BEATS[P.i].title}`;+ const b = BEATS[P.i];+ let text = '';+ if (captions && P.started && !b.ask && !P.done) {+ for (const [t, line] of TIMINGS[b.id].cues) { if (t > P.t + .05) break; text = line; }+ }+ if (text !== capText) { capText = text; $('caption').textContent = text; $('caption').hidden = !text; }+}+let captions = false, capText = '';+try { captions = localStorage.getItem('captions') === '1'; } catch {}+function setCaptions(on) {+ captions = on;+ $('bCC').setAttribute('aria-pressed', String(on));+ try { localStorage.setItem('captions', on ? '1' : '0'); } catch {}+}+setCaptions(captions);+function hideCover() { P.started = true; $('cover').hidden = true; }+function togglePlay() {+ if (!P.started) { hideCover(); return setPlaying(true); }+ if (P.waiting || P.done) return;+ setPlaying(!P.playing);+}+const back1 = () => seek(P.t > 2.5 || P.i === 0 ? P.i : P.i - 1);+const restart = () => { for (const k in SCORE) delete SCORE[k]; hideCover(); seek(0, true); };+$('cover').onclick = togglePlay;+$('stage').addEventListener('click', e => {+ const b = BEATS[P.i];+ if (!b.ask && !e.target.closest('.qlayer')) togglePlay();+});+$('bPlay').onclick = togglePlay;+$('bBack').onclick = () => { hideCover(); back1(); };+$('bRestart').onclick = restart;+$('bCC').onclick = () => setCaptions(!captions);+$('bFull').onclick = () => toggleFull();+const toggleFull = () => document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen?.();+let helpResume = false;+function toggleHelp() {+ const open = $('help').hidden;+ $('help').hidden = !open;+ if (open) { helpResume = P.playing; if (P.playing) setPlaying(false); }+ else if (helpResume) setPlaying(true);+}+// Every action has a key. A question's own keys (P.keys) come first; Shift reaches the player during a question.+document.addEventListener('keydown', e => {+ if (e.altKey || e.metaKey || e.ctrlKey) return;+ const k = e.key;+ if (!$('help').hidden) { if (k === 'Escape' || k === '?') { e.preventDefault(); toggleHelp(); } return; }+ if (e.target.matches?.('input')) { // typing an answer: only Enter (check) and Escape (leave the box) are ours+ if (k === 'Enter' && P.keys) { e.preventDefault(); P.keys(e); }+ else if (k === 'Escape') e.target.blur();+ return;+ }+ if (k === '?') { e.preventDefault(); toggleHelp(); return; }+ if ((k === 'Enter' || k === ' ') && e.target.closest?.('button, [tabindex], a')) return; // a Tab-focused control acts itself+ if (!P.started) { if (k === ' ' || k === 'Enter') { e.preventDefault(); togglePlay(); } return; }+ if (P.keys && !e.shiftKey && P.keys(e)) { e.preventDefault(); return; }+ const free = e.shiftKey || !P.keys;+ let used = true;+ if (k === ' ') togglePlay();+ else if (k === 'ArrowLeft' && free) back1();+ else if (k === 'ArrowRight' && free) { if (P.i < BEATS.length - 1) seek(P.i + 1); }+ else if (k === 'Home') restart();+ else if (k === 'c' || k === 'C') setCaptions(!captions);+ else if (k === 'f' || k === 'F') toggleFull();+ else used = false;+ if (used) e.preventDefault();+});+// Mouse clicks should not leave focus on a control, so Enter and Space keep meaning "check" and "play".+$('frame').addEventListener('mousedown', e => { if (e.target.closest('button, [tabindex]')) e.preventDefault(); });+$('bHelp').onclick = toggleHelp;+const fit = () => document.documentElement.style.setProperty('--k', Math.min(innerWidth / 1640, innerHeight / 1000));+addEventListener('resize', fit);+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-book progress shared with the cover/contents at the parent URL folder.+const BOOK_PROGRESS_KEY = 'animebook:progress:' + new URL('../', location.href).pathname;+function progress(f) {+ try { const p = JSON.parse(localStorage.getItem(BOOK_PROGRESS_KEY) || '{}'); f(p); localStorage.setItem(BOOK_PROGRESS_KEY, 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();+ const qs = new URLSearchParams(location.search);+ if (qs.has('beat')) {+ $('cover').hidden = true;+ seek(+qs.get('beat'), false);+ P.t = +(qs.get('t') || 0);+ evalTo(P.t);+ } else seek(0, false);+ requestAnimationFrame(frame);+}diff --git a/site/math-notebook/unit-art.js b/site/math-notebook/unit-art.jsnew file mode 100644index 0000000..b79cfaf--- /dev/null+++ b/site/math-notebook/unit-art.js@@ -0,0 +1,26 @@+// Chalk sketches for the unit headers on the contents page, one per unit, drawn in the unit's colour.+// Each entry is the inside of an SVG with viewBox 0 0 600 180; keep the left ~200 px light (the unit title sits there+// on narrow screens). Classes, styled in book.html:+// d a stroke that draws itself in when the unit scrolls into view (--k orders the strokes)+// t text or a filled shape that fades in+// a faint chalk white instead of the unit colour; faint even fainter+// A sketch may add one looping motion after it is drawn: give an element a class and add a .seen .unit-art .NAME+// rule with its keyframes in book.html (see the examples there: swap-a, hop, spin, tilt, breathe, ...).+'use strict';+(() => {+ let k = 0;+ const P = (d, cls = '', extra = '') => `<path class="d ${cls}" pathLength="1" style="--k:${k++}" d="${d}" ${extra}/>`;+ const Tx = (x, y, s, size = 24, cls = '', anchor = 'start') => `<text class="t ${cls}" style="--k:${k++}" x="${x}" y="${y}" font-size="${size}" text-anchor="${anchor}">${s}</text>`;+ const C = (cx, cy, r, cls = '') => `<circle class="d ${cls}" pathLength="1" style="--k:${k++}" cx="${cx}" cy="${cy}" r="${r}"/>`;+ const reset = s => { k = 0; return s; };++ window.UNIT_ART = [+ // 1 The Number System: nested rings of number families, and a dot hopping along a number line.+ reset(`<ellipse class="d a" pathLength="1" style="--k:${k++}" cx="470" cy="78" rx="110" ry="58"/>` ++ `<ellipse class="d" pathLength="1" style="--k:${k++}" cx="450" cy="84" rx="70" ry="40"/>` ++ `<ellipse class="d" pathLength="1" style="--k:${k++}" cx="440" cy="90" rx="36" ry="22"/>` ++ Tx(440, 98, '1 2 3', 20, '', 'middle') + Tx(546, 62, 'π', 26, 'a', 'middle') ++ P('M240 150H580') + Array.from({ length: 7 }, (_, i) => P(`M${260 + i * 50} 143v14`, 'a')).join('') ++ `<circle class="t hop" r="7" fill="currentColor" stroke="none" style="--k:${k++};offset-path:path('M260 140Q285 112 310 140Q335 112 360 140Q385 112 410 140')"/>`),+ ];+})();diff --git a/tools/math-notebook/register.py b/tools/math-notebook/register.pynew file mode 100644index 0000000..7c49c41--- /dev/null+++ b/tools/math-notebook/register.py@@ -0,0 +1,47 @@+"""Register a ready chapter: add it to UNITS on the contents page, set the previous chapter's CHAPTER.next,+and mark its row in chapters.md. python3 tools/math-notebook/register.py 2 8"""+import json, re, sys+from pathlib import Path++ROOT = Path(__file__).resolve().parents[2]+n, minutes = int(sys.argv[1]), int(sys.argv[2])+sections = {s['folder']: s for s in json.loads((ROOT / 'books/math-notebook/sections.json').read_text())}+sec = sections[f'ch{n:02d}']+title = re.sub(r'^Chapter \d+: ', '', sec['title']).replace('Graphic Inequalities', 'Graphing Inequalities')+unit = re.sub(r'^UNIT \d+: ', '', sec['unit'])++# contents page: UNITS = [ [unit, [[title, minutes], ...]], ... ]+idx = ROOT / 'site/math-notebook/index.html'+s = idx.read_text()+m = re.search(r"const UNITS = \[[^\n]*\n(.*?)\n\];", s, re.S)+lines = m.group(1).split('\n')+units = [json.loads(l.strip().rstrip(',').replace("'", '"')) for l in lines]+done = sum(len(c) for _, c in units)+if done >= n:+ sys.exit(f'ch{n:02d} already listed')+if done != n - 1:+ sys.exit(f'contents has {done} chapters; register ch{done + 1:02d} first')+if units[-1][0] == unit:+ units[-1][1].append([title, minutes])+else:+ units.append([unit, [[title, minutes]]])+js = lambda v: json.dumps(v, ensure_ascii=False).replace('"', "'").replace("', '", "', '")+body = '\n'.join(f" [{js(u)}, {js(c)}]," for u, c in units)+s = s[:m.start(1)] + body + s[m.end(1):]+idx.write_text(s)++# previous chapter's next link+if n > 1:+ prev = ROOT / f'site/math-notebook/ch{n - 1:02d}/index.html'+ p = prev.read_text()+ p2, k = re.subn(r"(const CHAPTER = \{[^}]*?)(, next: '[^']*')?( \};)", rf"\1, next: '../ch{n:02d}/'\3", p, count=1)+ if not k:+ sys.exit('CHAPTER line not found in previous chapter')+ prev.write_text(p2)++# chapters.md row+cm = ROOT / 'books/math-notebook/chapters.md'+c = cm.read_text()+c, k = re.subn(rf"^\| {n} \| (.*?) \| (\d+) \| [^|]* \| [^|]* \|$", rf"| {n} | \1 | \2 | {minutes} | ready |", c, count=1, flags=re.M)+cm.write_text(c)+print(f'registered ch{n:02d} "{title}" ({minutes} min, unit "{unit}"); chapters.md row updated: {bool(k)}')diff --git a/tools/math-notebook/smoke_ch01.py b/tools/math-notebook/smoke_ch01.pynew file mode 100644index 0000000..3149015--- /dev/null+++ b/tools/math-notebook/smoke_ch01.py@@ -0,0 +1,33 @@+"""Keyboard smoke test for ch01 quick checks: grid (q1), sorter (q2), tap (q3), then the score card."""+import asyncio, sys+from playwright.async_api import async_playwright+URL = (sys.argv[1] if len(sys.argv) > 1 else 'http://localhost:8765/math-notebook/').rstrip('/') + '/ch01/'++async def main():+ async with async_playwright() as pw:+ b = await pw.chromium.launch(); pg = await b.new_page(viewport={'width': 1600, 'height': 1000})+ errs = []; pg.on('pageerror', lambda e: errs.append(str(e)))+ await pg.goto(URL); await pg.wait_for_function('typeof TIMINGS !== "undefined" && typeof BEATS !== "undefined"')+ k = pg.keyboard+ async def at(i): await pg.evaluate(f'hideCover(); seek({i}, false)'); await pg.wait_for_timeout(300)+ async def fb(): return (await pg.locator('#ui .fb').first.inner_text()).strip()+ # q1: −4 → 3; 0 → 2,3; 9 → 1,2,3 (one wrong row first)+ await at(4)+ for keys in (['3'], ['ArrowDown', '2', '3'], ['ArrowDown', '1', '2']):+ for x in keys: await k.press(x)+ print('q1 state:', await pg.evaluate("[...document.querySelectorAll('#ui .grid .row')].map(r => [...r.querySelectorAll('.opt')].map(b => b.getAttribute('aria-pressed') === 'true' ? 1 : 0).join(''))"))+ await k.press('Enter'); print('q1 wrong:', await fb())+ await k.press('3'); await k.press('Enter'); print('q1 right:', await fb())+ # q2: sorter by keys: each number gets its ring key, in tray order+ await at(9)+ await k.press('ArrowRight')+ for ring in '123445': await k.press(ring)+ await k.press('Enter'); print('q2:', await fb())+ # q3: tap −1/2 (second of four points), then −1 (second of two)+ await at(12)+ await k.press('ArrowRight'); await k.press('ArrowRight'); await k.press('Enter'); print('q3a:', await fb())+ await k.press('Enter'); await pg.wait_for_timeout(200)+ await k.press('ArrowLeft'); await k.press('Enter'); print('q3b:', await fb())+ await at(17); print('finish:', (await pg.locator('#ui').inner_text()).replace('\n', ' | ')[:200])+ print('errors:', errs or 'none'); await b.close()+asyncio.run(main())diff --git a/tools/math-notebook/smoke_ch02.py b/tools/math-notebook/smoke_ch02.pynew file mode 100644index 0000000..1d9369c--- /dev/null+++ b/tools/math-notebook/smoke_ch02.py@@ -0,0 +1,48 @@+"""Keyboard smoke test for ch02: sign grid (q1), taps (q2, q3), sentence blanks with + and commas (final1, final2), T/F grid (final3)."""+import asyncio, sys+from playwright.async_api import async_playwright+URL = (sys.argv[1] if len(sys.argv) > 1 else 'http://localhost:8765/math-notebook/').rstrip('/') + '/ch02/'++async def main():+ async with async_playwright() as pw:+ b = await pw.chromium.launch(); pg = await b.new_page(viewport={'width': 1600, 'height': 1000})+ errs = []; pg.on('pageerror', lambda e: errs.append(str(e)))+ await pg.goto(URL); await pg.wait_for_function('typeof TIMINGS !== "undefined" && typeof BEATS !== "undefined"')+ k = pg.keyboard+ async def at(i): await pg.evaluate(f'hideCover(); seek({i}, false)'); await pg.wait_for_timeout(300)+ async def fb(): return (await pg.locator('#ui .fb').first.inner_text()).strip()+ async def nxt(): await k.press('Enter'); await pg.wait_for_timeout(200)+ # q1: −6 N, +3 P (first try wrong: N), 0 → 0, −1.5 N+ await at(3)+ for x in ['n', 'n', '0', 'n']: await k.press(x)+ await k.press('Enter'); print('q1 wrong:', await fb())+ await k.press('ArrowUp'); await k.press('ArrowUp'); await k.press('p'); await k.press('Enter'); print('q1 right:', await fb())+ # q2: −3 is the 2nd of [-4,-3,3,4]; first try 3 (wrong), then −3; then 5 = 3rd of [-6,-5,5,6]+ await at(6)+ for x in ['ArrowRight'] * 3: await k.press(x)+ await k.press('Enter'); print('q2a wrong:', await fb())+ await k.press('ArrowLeft'); await k.press('Enter'); print('q2a right:', await fb())+ await nxt()+ for x in ['ArrowRight'] * 3: await k.press(x)+ await k.press('Enter'); print('q2b:', await fb())+ # q3: −3 (2nd), then −7 (1st of 2)+ await at(10)+ await k.press('ArrowRight'); await k.press('ArrowRight'); await k.press('Enter'); print('q3a:', await fb())+ await nxt()+ await k.press('ArrowRight'); await k.press('Enter'); print('q3b:', await fb())+ # final1: typed with a + and a comma-free plain answer+ await at(12); await pg.wait_for_timeout(200)+ for v in ['−250', '+900', '-6', '-12', '+340']: await k.type(v); await k.press('Tab')+ await k.press('Escape'); await k.press('Enter'); print('final1:', await fb())+ # final2: one wrong row first+ await at(13); await pg.wait_for_timeout(200)+ for v in ['-9', '100', '-58', '-35', '0']: await k.type(v); await k.press('Tab')+ await k.press('Escape'); await k.press('Enter'); print('final2 wrong:', await fb())+ await k.press('s'); print('final2 shown:', await fb())+ # final3: T F T T F+ await at(14)+ for x in 'tftt': await k.press(x)+ await k.press('f'); await k.press('Enter'); print('final3:', await fb())+ await at(15); print('finish:', (await pg.locator('#ui').inner_text()).replace('\n', ' | ')[:200])+ print('errors:', errs or 'none'); await b.close()+asyncio.run(main())diff --git a/tools/math-notebook/smoke_ch03.py b/tools/math-notebook/smoke_ch03.pynew file mode 100644index 0000000..1a44605--- /dev/null+++ b/tools/math-notebook/smoke_ch03.py@@ -0,0 +1,51 @@+"""Keyboard smoke test for ch03: taps with distance-tape effects (q1, q3), blanks beside the depth scale (q2),+evaluation blanks with a fraction (final1, final2), sentence blanks with a $ (final3), T/F grid (final4)."""+import asyncio, sys+from pathlib import Path+from playwright.async_api import async_playwright+URL = (sys.argv[1] if len(sys.argv) > 1 else 'http://localhost:8765/math-notebook/').rstrip('/') + '/ch03/'++async def main():+ async with async_playwright() as pw:+ b = await pw.chromium.launch(); pg = await b.new_page(viewport={'width': 1600, 'height': 1000})+ errs = []; pg.on('pageerror', lambda e: errs.append(str(e))); pg.on('console', lambda m: m.type == 'error' and errs.append(m.text))+ await pg.goto(URL); await pg.wait_for_function('typeof TIMINGS !== "undefined" && typeof BEATS !== "undefined"')+ k = pg.keyboard+ async def at(i): await pg.evaluate(f'hideCover(); seek({i}, false)'); await pg.wait_for_timeout(300)+ async def fb(): return (await pg.locator('#ui .fb').first.inner_text()).strip()+ async def nxt(): await k.press('Enter'); await pg.wait_for_timeout(200)+ # q1: |x| = 2 among [-3,-2,0,3]: −3 first (wrong), then −2; then the farther of [-6, 4]+ await at(3)+ await k.press('ArrowRight'); await k.press('Enter'); print('q1a wrong:', await fb())+ await k.press('ArrowRight'); await k.press('Enter'); print('q1a right:', await fb())+ await nxt()+ await k.press('ArrowRight'); await k.press('Enter'); print('q1b:', await fb())+ # q2: depth 120, debt 18.25+ await at(6); await pg.wait_for_timeout(200)+ await k.type('-120'); await k.press('Enter'); print('q2a wrong:', await fb())+ await pg.locator('#ui input.box').first.fill('120'); await k.press('Enter'); print('q2a right:', await fb())+ await nxt(); await pg.wait_for_timeout(200)+ await k.type('18.25'); await k.press('Enter'); print('q2b:', await fb())+ # q3: −|−3| = −3 (2nd of 4), |6 − 2| = 4 (last of 4)+ await at(9)+ await k.press('ArrowRight'); await k.press('ArrowRight'); await k.press('Enter'); print('q3a:', await fb())+ await nxt()+ await k.press('ArrowLeft'); await k.press('Enter'); print('q3b:', await fb())+ await at(13); await pg.wait_for_timeout(200)+ for v in ['23', '61', '3.5', '3/8', '0']: await k.type(v); await k.press('Tab')+ await k.press('Escape'); await k.press('Enter'); print('final1:', await fb())+ await at(14); await pg.wait_for_timeout(200)+ for v in ['5', '12', '-38', '12', '15']: await k.type(v); await k.press('Tab')+ await k.press('Escape'); await k.press('Enter'); print('final2 wrong:', await fb())+ await k.press('s'); print('final2 shown:', await fb())+ await at(15); await pg.wait_for_timeout(200)+ for v in ['$64.20', '85', '9']: await k.type(v); await k.press('Tab')+ await k.press('Escape'); await k.press('Enter'); print('final3:', await fb())+ await at(16)+ for x in 'tftf': await k.press(x)+ await k.press('t'); await k.press('Enter'); print('final4:', await fb())+ await at(17); print('finish:', (await pg.locator('#ui').inner_text()).replace('\n', ' | ')[:200])+ Path('/tmp/animebook-mn-ch03').mkdir(parents=True, exist_ok=True)+ await pg.screenshot(path='/tmp/animebook-mn-ch03/smoke_end.png')+ print('errors:', errs or 'none'); await b.close()+asyncio.run(main())