Skip to content

An AI skill that turns books into animated, narrated, interactive web experiences

feat(science): ch10 part 2, the first law

yzr9d08e63adb85
diff --git a/site/science/ch10/audio/en/law1.mp3 b/site/science/ch10/audio/en/law1.mp3
new file mode 100644
index 0000000..e7b8bc5
Binary files /dev/null and b/site/science/ch10/audio/en/law1.mp3 differ
diff --git a/site/science/ch10/audio/en/mass.mp3 b/site/science/ch10/audio/en/mass.mp3
new file mode 100644
index 0000000..28f7bd0
Binary files /dev/null and b/site/science/ch10/audio/en/mass.mp3 differ
diff --git a/site/science/ch10/audio/en/momentum.mp3 b/site/science/ch10/audio/en/momentum.mp3
new file mode 100644
index 0000000..3b52e48
Binary files /dev/null and b/site/science/ch10/audio/en/momentum.mp3 differ
diff --git a/site/science/ch10/audio/en/part2.mp3 b/site/science/ch10/audio/en/part2.mp3
new file mode 100644
index 0000000..0e04117
Binary files /dev/null and b/site/science/ch10/audio/en/part2.mp3 differ
diff --git a/site/science/ch10/audio/en/q2.mp3 b/site/science/ch10/audio/en/q2.mp3
new file mode 100644
index 0000000..b5fff51
Binary files /dev/null and b/site/science/ch10/audio/en/q2.mp3 differ
diff --git a/site/science/ch10/audio/en/rest.mp3 b/site/science/ch10/audio/en/rest.mp3
new file mode 100644
index 0000000..6d9e9e9
Binary files /dev/null and b/site/science/ch10/audio/en/rest.mp3 differ
diff --git a/site/science/ch10/audio/en/wrap2.mp3 b/site/science/ch10/audio/en/wrap2.mp3
new file mode 100644
index 0000000..8dcfcfc
Binary files /dev/null and b/site/science/ch10/audio/en/wrap2.mp3 differ
diff --git a/site/science/ch10/index.html b/site/science/ch10/index.html
index b7fc3ec..2abd1b5 100644
--- a/site/science/ch10/index.html
+++ b/site/science/ch10/index.html
@@ -151,6 +151,144 @@ const BEATS = [
});
txt(p, 'Next: Newton’s first law.', 800, 760, m('end'), { size: 32, fill: COL.dim, weight: 500 });
}],
+/* ---------- part 2: Newton's first law ---------- */
+['part2', 'Part 2 · The first law', (m, D) => {
+ const p = panel(0);
+ ground(p);
+ phBall(p, 28, { x: 800, y: GY - 28 }); phSprite(p, 'you_point', { x: 690, y: GY });
+ const g = G(p, { o: 0, y: 24 });
+ T(g, 'Chapter 10 · Force and Newton’s laws', { x: 800, y: 130, size: 28, fill: COL.dim, anchor: 'middle' });
+ phLabel(g, 'The First Law', { x: 800, y: 250, size: 110, weight: 600 });
+ tw(g, { o: 1, y: 0 }, .2, 1.1, out);
+ txt(p, 'Part 2 · Inertia and momentum', 800, 320, m('q'), { size: 36, fill: COL.dim });
+}],
+['rest', 'At rest, in motion', (m, D) => {
+ const p = panel(0);
+ const tk = m('kick'), ts = m('space'), R = 28, V0 = 360, A = 90, T0 = V0 / A; // grass friction: 90 px/s², stops after 4 s
+ const field = camera(p, D);
+ ground(field.world);
+ const ball = phBall(field.world, R, { x: 560, y: GY - R }), kid = phSprite(field.world, 'you_point', { x: 470, y: GY });
+ const vA = path(field.world, '', { stroke: VEL, 'stroke-width': 8 }), kick = forceArrow(field.world), fr = forceArrow(field.world);
+ const stay = txt(p, 'at rest: it stays at rest', 800, 150, m('stay'), { size: 36 });
+ const roll = txt(p, 'friction from grass and air slows it and stops it', 800, 210, m('stop'), { size: 30, fill: FORCE });
+ // Then deep space: a second camera fades in over the field and follows the ball; no friction, so nothing changes.
+ const sky = camera(p, D, { x: 800, y: 450 });
+ put(sky.el, { o: 0 }); show(sky.el, ts, .7);
+ prog(q => { if (q === 1) field.el.style.display = 'none'; }, ts + .75, 0, lin);
+ const stars = sky.layer(1, 2400);
+ for (let i = 0; i < 70; i++) { const k = 2 + 3 * phHash(i, 7); mk('rect', { x: -800 + 4800 * phHash(i, 1), y: 900 * phHash(i, 2), width: k, height: k, fill: COL.chalk, opacity: .3 + .5 * phHash(i, 3) }, stars); }
+ const sb = phBall(sky.world, R, { y: 450 }), sv = path(sky.world, '', { stroke: VEL, 'stroke-width': 8 });
+ const sx = t => 300 + 220 * (t - ts);
+ sky.cut({ x: t => sx(t) + 300 }, 0);
+ const sl = G(p, { o: 0 }); phLabel(sl, 'deep space: no friction', { x: 800, y: 120, size: 38 }); phLabel(sl, 'velocity stays the same', { x: 800, y: 170, size: 30, fill: VEL });
+ show(sl, ts + .4); hide(roll, ts, .3); hide(stay, ts, .3);
+ clockRun(t => {
+ const u = Math.max(0, t - tk - .15), tt = Math.min(u, T0), x = 560 + V0 * tt - A * tt * tt / 2, v = u < T0 ? V0 - A * u : 0;
+ put(ball, { x }); put(ball._spin, { r: (x - 560) / R * 180 / Math.PI });
+ arrowAt(vA, x + R + 6, GY - R, v * .35, 0);
+ kick.set(560 - R - 110, GY - R, t > tk - .3 && t < tk + .5 ? 100 : 0, 0, 'kick', 0, -14);
+ fr.set(x - R - 6, GY - 80, v > 0 && t > tk + .5 ? 70 : 0, 180, 'friction');
+ put(kid, { x: 470 + Math.min(40, 80 * Math.max(0, t - tk + .4)) });
+ const z = sx(t); put(sb, { x: z }); put(sb._spin, { r: z / R * 180 / Math.PI }); arrowAt(sv, z + R + 6, 450, 110, 0);
+ }, D);
+}, { lead: false }],
+['law1', 'Newton’s first law', (m, D) => {
+ const p = panel(0);
+ const law = G(p, { o: 0 });
+ phLabel(law, 'An object at rest stays at rest, and an object in motion', { x: 800, y: 130, size: 36 });
+ phLabel(law, 'stays in motion, unless a net force acts on it.', { x: 800, y: 180, size: 36 });
+ show(law, m('law'));
+ // left: a crate that stays put; right: a puck gliding on ice at a steady velocity
+ phBlock(p, 80, 470, 640, 14, PH.walk, { top: 0, ol: 0 }); crate(p, { x: 400, y: 470 });
+ T(p, 'at rest → stays at rest', { x: 400, y: 540, size: 30, weight: 700, anchor: 'middle' });
+ phBlock(p, 880, 470, 640, 14, '#cfe8f3', { top: 0, ol: 0 });
+ const puck = mk('rect', { x: -30, y: -22, width: 60, height: 22, rx: 8, fill: '#22282a' }, G(p)).parentNode, pv = path(p, '', { stroke: VEL, 'stroke-width': 8 });
+ T(p, 'in motion → stays in motion', { x: 1200, y: 540, size: 30, weight: 700, anchor: 'middle' });
+ const ig = G(p, { o: 0 });
+ phLabel(ig, 'inertia', { x: 800, y: 660, size: 64, fill: COL.chalk });
+ T(ig, 'matter resists changes to its motion: the first law is the law of inertia', { x: 800, y: 710, size: 28, fill: COL.dim, anchor: 'middle' });
+ show(ig, m('inert'));
+ const joke = G(p, { o: 0 });
+ phSprite(joke, 'you_down', { x: 1330, y: 870, s: 1.4 });
+ phLabel(joke, '“Time to get up!”', { x: 1020, y: 790, size: 26, fill: COL.dim }); phLabel(joke, '“But… inertia…”', { x: 1340, y: 790, size: 26 });
+ show(joke, m('inert', 3));
+ clockRun(t => { const x = 920 + ((140 * t) % 600); put(puck, { x, y: 470 }); arrowAt(pv, x + 36, 425, 90, 0); }, D);
+}],
+['mass', 'More mass, more inertia', (m, D) => {
+ const p = panel(0);
+ const tc = m('catch'), LA = 330, LB = 600;
+ txt(p, 'More mass → more inertia', 800, 110, .2, { size: 44 });
+ [LA, LB].forEach(y => phBlock(p, 0, y + 70, 1600, 8, PH.walk, { top: 0, ol: 0 }));
+ const ct = phSprite(p, 'friend_point', { x: 1240, y: LA + 70 }), cb = phSprite(p, 'friend_point', { x: 1240, y: LB + 70 });
+ phFace(ct, -1); phFace(cb, -1);
+ const tb = mk('circle', { r: 14, fill: '#d7e24a', ...phLine(2) }, G(p)).parentNode, bb = mk('circle', { r: 40, fill: '#e07a2e', ...phLine(2.5) }, G(p)).parentNode;
+ path(bb, 'M-40 0H40M0 -40V40', { stroke: '#7a3a12', 'stroke-width': 3 });
+ const vT = path(p, '', { stroke: VEL, 'stroke-width': 8 }), vB = path(p, '', { stroke: VEL, 'stroke-width': 8 }), sT = forceArrow(p), sB = forceArrow(p);
+ phLabel(p, 'tennis ball: little mass', { x: 300, y: LA - 40, size: 30 }); phLabel(p, 'basketball: more mass', { x: 300, y: LB - 70, size: 30 });
+ txt(p, 'easy to stop', 1240, LA - 110, m('easy'), { size: 30, fill: FORCE });
+ txt(p, 'harder to stop: it pushes you back', 1240, LB - 140, m('hard'), { size: 30, fill: FORCE });
+ // Same speed; the catch begins at x = 1180. The tennis ball stops in 0.2 s; the basketball needs 1 s and shoves the catcher.
+ const V = 300, xc = 1180, tTen = tc + (xc - 200) / V;
+ clockRun(t => {
+ const u = t - tc, xT = u < 0 ? 200 : Math.min(xc, 200 + V * u) + (t > tTen ? Math.min(12, 30 * (t - tTen)) : 0);
+ const stopT = Math.max(0, Math.min(1.2, t - tTen)), xB = u < 0 ? 200 : t < tTen ? 200 + V * u : xc + V * stopT - V / 2.4 * stopT * stopT;
+ put(tb, { x: xT, y: LA + 40 }); put(bb, { x: xB, y: LB + 30 }); put(cb, { x: 1240 + Math.max(0, xB - xc) });
+ arrowAt(vT, xT + 20, LA - 10, t < tTen && u > 0 ? 90 : 0, 0); arrowAt(vB, xB + 46, LB - 30, t < tTen + 1.2 && u > 0 ? 90 * (t < tTen ? 1 : 1 - stopT / 1.2) : 0, 0);
+ sT.set(xT + 70, LA + 20, t > tTen && t < tTen + .35 ? 60 : 0, 180, ''); sB.set(xB + 110, LB + 10, t > tTen && t < tTen + 1.2 ? 60 : 0, 180, '');
+ }, D);
+}],
+['momentum', 'Momentum', (m, D) => {
+ const p = panel(0);
+ show(runs(p, [['momentum', COL.chalk], [' = mass × ', COL.chalk], ['velocity', VEL]], { x: 800, y: 150, size: 52, weight: 700 }), m('f'));
+ // Overhead pool table: the cue ball hits a ball of the same mass, stops, and passes on all of its momentum.
+ phBlock(p, 200, 300, 1200, 400, '#6b4a30', { top: 0, ol: 0 }); phBlock(p, 240, 340, 1120, 320, '#2f7d4f', { top: 0, ol: 0 });
+ const cue = mk('circle', { r: 30, fill: '#f4f1e8', ...phLine(2) }, G(p)).parentNode, red = mk('circle', { r: 30, fill: '#d24b4b', ...phLine(2) }, G(p)).parentNode;
+ const vc = path(p, '', { stroke: VEL, 'stroke-width': 8 }), vr = path(p, '', { stroke: VEL, 'stroke-width': 8 });
+ const lc = phLabel(p, '', { size: 26 }), lr = phLabel(p, '', { size: 26 }), tot = phLabel(p, '', { x: 800, y: 760, size: 36, fill: COL.chalk });
+ const t0 = m('pool'), xHit = 760, V = 260, tHit = t0 + (xHit - 330) / V;
+ show(lc, t0); show(lr, t0); put(lc, { o: 0 }); put(lr, { o: 0 }); put(tot, { o: 0 }); show(tot, m('cons'));
+ clockRun(t => {
+ const xc = t < t0 ? 330 : Math.min(xHit, 330 + V * (t - t0)), xr = t < tHit ? 820 : Math.min(1300, 820 + V * (t - tHit));
+ put(cue, { x: xc, y: 500 }); put(red, { x: xr, y: 500 });
+ const mc = t >= t0 && t < tHit, mr = t >= tHit && xr < 1300;
+ arrowAt(vc, xc + 36, 455, mc ? 90 : 0, 0); arrowAt(vr, xr + 36, 455, mr ? 90 : 0, 0);
+ put(lc, { x: xc, y: 590 }); phText(lc, mc ? '0.2 kg × 2 m/s = 0.4' : '0');
+ put(lr, { x: xr, y: 590 }); phText(lr, mr || xr >= 1300 ? '0.2 kg × 2 m/s = 0.4' : '0');
+ phText(tot, `total momentum ${t < tHit ? 'before' : 'after'}: 0.4 kg·m/s`);
+ }, D);
+}],
+['q2', 'Quick check', (m, D) => {
+ const p = panel(0);
+ ground(p);
+ const ball = phBall(p, 26, { y: GY - 26 }), vA = path(p, '', { stroke: VEL, 'stroke-width': 8 }), fr = forceArrow(p);
+ clockRun(t => { const tt = Math.min(t, 3.6), x = 300 + 300 * tt - 42 * tt * tt, v = Math.max(0, 300 - 84 * t);
+ put(ball, { x }); put(ball._spin, { r: x / 26 * 180 / Math.PI }); arrowAt(vA, x + 32, GY - 26, v * .3, 0); fr.set(x - 32, GY - 80, v > 0 ? 70 : 0, 180, 'friction'); }, D);
+}, { ask: done => quiz(Q_CARD, [
+ { id: 'c-inertia', prompt: ['A bowling ball and a soccer ball are the same size. Which has more ', h('b', '', 'inertia'), '?'],
+ build: choice([['the bowling ball'], ['the soccer ball'], ['they have the same inertia']], 0,
+ 'The bowling ball has much more mass, so it resists changes in motion more.',
+ [null, 'The soccer ball is lighter: less mass, less inertia.', 'Inertia depends on mass, not size.']) },
+ { id: 'c-friction', prompt: ['A ball rolling on grass slows down and stops. Why?'],
+ build: choice([['friction pushes against its motion'], ['it runs out of inertia'], ['no force acts on it']], 0,
+ 'Friction from the grass and air is a force against the motion: an unbalanced force that slows it down.',
+ [null, 'Inertia is not used up; the ball would keep rolling without friction.', 'With no force at all, it would keep rolling forever (first law).']) },
+ { id: 'c-mom', prompt: ['A 2 kilogram ball rolls at 3 meters per second. What is its ', h('b', '', 'momentum'), '?'],
+ build: blanks([{ parts: ['momentum = 2 × 3 = ', { box: '6' }, ' kilogram meters per second'], why: 'mass × velocity = 2 × 3 = 6.', hint: 'Momentum = mass × velocity.' }]) },
+], done) }],
+['wrap2', 'Summary · First law', (m, D) => {
+ const p = panel(0);
+ txt(p, 'Newton’s first law', 800, 140, .2, { size: 40, fill: COL.dim });
+ [['Objects keep their motion unless a net force acts on them.', 'w1'],
+ ['Inertia resists changes in motion; more mass, more inertia.', 'w2'],
+ ['Momentum = mass × velocity; a collision keeps the total the same.', 'w3']].forEach(([s, mark], i) => {
+ const g = G(p, { x: -16, y: 290 + i * 130, o: 0 });
+ mk('rect', { x: 144, y: -38, width: 52, height: 52, rx: 6, fill: PH.ref }, g);
+ T(g, String(i + 1), { x: 170, y: -1, size: 30, fill: COL.board, weight: 700, anchor: 'middle' });
+ T(g, s, { x: 230, size: 36, weight: 600 });
+ tw(g, { o: 1, x: 0 }, m(mark), .6);
+ });
+ txt(p, 'Next: Newton’s second law.', 800, 760, m('end'), { size: 32, fill: COL.dim, weight: 500 });
+}],
/*BEATS*/
].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));
diff --git a/site/science/img/you_down.png b/site/science/img/you_down.png
new file mode 100644
index 0000000..2e74201
Binary files /dev/null and b/site/science/img/you_down.png differ
diff --git a/site/science/lib/figures.js b/site/science/lib/figures.js
index 47830de..b8dce68 100644
--- a/site/science/lib/figures.js
+++ b/site/science/lib/figures.js
@@ -48,7 +48,7 @@ const PH_SPR = { car: [32, 13], truck: [44, 24], lamp: [7, 27], tree: [16, 20],
you: [9, 15], you_walk1: [7, 15], you_walk2: [11, 15], friend: [9, 15], friend_walk1: [7, 15], friend_walk2: [11, 15],
runner: [7, 15], runner_walk1: [6, 15], runner_walk2: [11, 15], dolphin: [25, 8], walrus: [20, 11], light_red: [6, 21], light_green: [6, 21],
car_top: [18, 8], you_top: [7, 7], bee: [9, 5],
- you_point: [13, 15], friend_point: [13, 15], rider: [8, 15], bike: [16, 10], cart: [14, 11], can: [5, 8], can_crushed: [7, 5], apple: [6, 6] }; // *_top: seen from above, facing east; their origin is the centre (phTop)
+ you_point: [13, 15], friend_point: [13, 15], rider: [8, 15], bike: [16, 10], cart: [14, 11], can: [5, 8], can_crushed: [7, 5], apple: [6, 6], you_down: [15, 5] }; // *_top: seen from above, facing east; their origin is the centre (phTop)
function phSprite(p, name, { x = 0, y = 0, s = 1, o = 1 } = {}) {
const g = G(p, { x, y, s, o });
g._in = mk('g', {}, g); // mirrored by phFace