An AI skill that turns books into animated, narrated, interactive web experiences
JavaScript ai-agentsai-educationanimationclaudeclaude-codeclaude-skillsedtecheducationinteractive-textbookscormtext-to-video
feat(science): ch10 part 1, force and net force
yzraf0fa8e56312
diff --git a/site/science/ch10/audio/en/balance.mp3 b/site/science/ch10/audio/en/balance.mp3new file mode 100644index 0000000..6d3f884Binary files /dev/null and b/site/science/ch10/audio/en/balance.mp3 differdiff --git a/site/science/ch10/audio/en/force.mp3 b/site/science/ch10/audio/en/force.mp3new file mode 100644index 0000000..bfae528Binary files /dev/null and b/site/science/ch10/audio/en/force.mp3 differdiff --git a/site/science/ch10/audio/en/intro.mp3 b/site/science/ch10/audio/en/intro.mp3new file mode 100644index 0000000..656aaa7Binary files /dev/null and b/site/science/ch10/audio/en/intro.mp3 differdiff --git a/site/science/ch10/audio/en/net.mp3 b/site/science/ch10/audio/en/net.mp3new file mode 100644index 0000000..f900ef7Binary files /dev/null and b/site/science/ch10/audio/en/net.mp3 differdiff --git a/site/science/ch10/audio/en/newton.mp3 b/site/science/ch10/audio/en/newton.mp3new file mode 100644index 0000000..39ae5a5Binary files /dev/null and b/site/science/ch10/audio/en/newton.mp3 differdiff --git a/site/science/ch10/audio/en/q1.mp3 b/site/science/ch10/audio/en/q1.mp3new file mode 100644index 0000000..12a336bBinary files /dev/null and b/site/science/ch10/audio/en/q1.mp3 differdiff --git a/site/science/ch10/audio/en/timings.js b/site/science/ch10/audio/en/timings.jsnew file mode 100644index 0000000..886a4f1--- /dev/null+++ b/site/science/ch10/audio/en/timings.js@@ -0,0 +1,684 @@+window.TIMINGS = {+ "intro": {+ "dur": 6.816,+ "marks": {+ "sub": 3.594+ },+ "cues": [+ [+ 0.104,+ "Chapter ten."+ ],+ [+ 1.25,+ "Force and Newton's laws of motion."+ ],+ [+ 3.594,+ "What makes things start, stop, speed up, or turn?"+ ]+ ]+ },+ "force": {+ "dur": 21.024,+ "marks": {+ "push": 2.344,+ "pull": 4.635,+ "dir": 6.719,+ "shape": 15.182+ },+ "cues": [+ [+ 0.104,+ "A force is a push or a pull."+ ],+ [+ 2.344,+ "Push a cart, and it starts to move."+ ],+ [+ 4.635,+ "Pull it, and it follows you."+ ],+ [+ 6.719,+ "Every force has a size and a direction, so we draw it as an arrow: the longer the arrow, the bigger the force."+ ],+ [+ 15.182,+ "A force can even change an object's shape, like squeezing an empty can until it crumples."+ ]+ ]+ },+ "net": {+ "dur": 22.2,+ "marks": {+ "add": 3.19,+ "sub": 10.417,+ "netw": 18.06+ },+ "cues": [+ [+ 0.104,+ "Often, more than one force acts at once."+ ],+ [+ 3.19,+ "When two forces point the same way, they add up: three newtons plus two newtons is five newtons."+ ],+ [+ 10.417,+ "When they point in opposite directions, they subtract: five newtons against three newtons leaves two newtons."+ ],+ [+ 18.06,+ "The total of all the forces on an object is called the net force."+ ]+ ]+ },+ "balance": {+ "dur": 18.744,+ "marks": {+ "bal": 1.341,+ "unbal": 10.703+ },+ "cues": [+ [+ 0.091,+ "In a tug-of-war, two teams pulling equally hard cancel each other out."+ ],+ [+ 4.974,+ "The net force is zero."+ ],+ [+ 7.161,+ "These are balanced forces, and nothing changes."+ ],+ [+ 10.703,+ "If one side pulls harder, the forces are unbalanced."+ ],+ [+ 14.909,+ "The net force points one way, and the rope starts to move."+ ]+ ]+ },+ "newton": {+ "dur": 14.16,+ "marks": {+ "apple": 4.401,+ "def": 6.966+ },+ "cues": [+ [+ 0.143,+ "Force is measured in newtons, named after Isaac Newton."+ ],+ [+ 4.401,+ "Holding up an apple takes about one newton."+ ],+ [+ 6.966,+ "One newton is the force that gives a one kilogram mass an acceleration of one meter per second squared."+ ]+ ]+ },+ "q1": {+ "dur": 3.216,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.224,+ "Forces and net force."+ ]+ ]+ },+ "wrap1": {+ "dur": 19.2,+ "marks": {+ "w1": 0.99,+ "w2": 5.273,+ "w3": 12.005,+ "end": 16.862+ },+ "cues": [+ [+ 0.104,+ "To sum up."+ ],+ [+ 0.99,+ "A force is a push or a pull, with a size and a direction."+ ],+ [+ 5.273,+ "Forces in the same direction add; opposite forces subtract."+ ],+ [+ 9.688,+ "The total is the net force."+ ],+ [+ 12.005,+ "Balanced forces cancel out; unbalanced forces change motion."+ ],+ [+ 16.862,+ "Next: Newton's first law."+ ]+ ]+ },+ "part2": {+ "dur": 4.896,+ "marks": {+ "q": 2.526+ },+ "cues": [+ [+ 0.117,+ "Part two."+ ],+ [+ 1.016,+ "Newton's first law."+ ],+ [+ 2.526,+ "Why do things keep doing what they're already doing?"+ ]+ ]+ },+ "rest": {+ "dur": 17.256,+ "marks": {+ "stay": 2.37,+ "kick": 5.026,+ "roll": 6.029,+ "stop": 7.878,+ "space": 12.24+ },+ "cues": [+ [+ 0.104,+ "A soccer ball lies in a field."+ ],+ [+ 2.37,+ "It stays there, until a force acts on it, like a kick."+ ],+ [+ 6.029,+ "Once it's rolling, it would keep rolling, but friction from the grass and the air pushes against it and stops it."+ ],+ [+ 12.24,+ "Kick a ball in deep space, with nothing to slow it down, and it just keeps going."+ ]+ ]+ },+ "law1": {+ "dur": 17.4,+ "marks": {+ "law": 2.148,+ "inert": 9.479+ },+ "cues": [+ [+ 0.104,+ "This is Newton's first law."+ ],+ [+ 2.148,+ "An object at rest stays at rest, and an object in motion stays in motion, unless a net force acts on it."+ ],+ [+ 9.479,+ "Matter resists changes to its motion."+ ],+ [+ 12.161,+ "This is called inertia, so the first law is also called the law of inertia."+ ]+ ]+ },+ "mass": {+ "dur": 12.504,+ "marks": {+ "catch": 2.878,+ "easy": 6.836,+ "hard": 9.688+ },+ "cues": [+ [+ 0.091,+ "Objects with more mass have more inertia."+ ],+ [+ 2.878,+ "Catch a tennis ball and a basketball moving at the same speed."+ ],+ [+ 6.836,+ "The light tennis ball is easy to stop."+ ],+ [+ 9.688,+ "The heavy basketball is harder to stop."+ ]+ ]+ },+ "momentum": {+ "dur": 20.136,+ "marks": {+ "f": 4.089,+ "pool": 7.513,+ "cons": 12.604+ },+ "cues": [+ [+ 0.091,+ "Momentum measures how hard it is to stop something that's moving."+ ],+ [+ 4.089,+ "Momentum equals mass times velocity."+ ],+ [+ 7.513,+ "When one pool ball hits another, it passes its momentum to the ball it hits."+ ],+ [+ 12.604,+ "The total momentum before and after the collision stays the same."+ ],+ [+ 17.044,+ "This is called the conservation of momentum."+ ]+ ]+ },+ "q2": {+ "dur": 3.048,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.146,+ "Inertia and momentum."+ ]+ ]+ },+ "wrap2": {+ "dur": 21.648,+ "marks": {+ "w1": 1.003,+ "w2": 6.836,+ "w3": 12.969,+ "end": 19.323+ },+ "cues": [+ [+ 0.104,+ "To sum up."+ ],+ [+ 1.003,+ "Newton's first law: objects keep their state of motion unless a net force acts on them."+ ],+ [+ 6.836,+ "Inertia is matter's resistance to changes in motion; more mass means more inertia."+ ],+ [+ 12.969,+ "Momentum equals mass times velocity, and in a collision the total stays the same."+ ],+ [+ 19.323,+ "Next: Newton's second law."+ ]+ ]+ },+ "part3": {+ "dur": 5.424,+ "marks": {+ "q": 2.63+ },+ "cues": [+ [+ 0.104,+ "Part three."+ ],+ [+ 1.224,+ "Newton's second law."+ ],+ [+ 2.63,+ "How much does a force change an object's motion?"+ ]+ ]+ },+ "law2": {+ "dur": 16.68,+ "marks": {+ "law": 2.24,+ "more": 7.982,+ "rearr": 11.406+ },+ "cues": [+ [+ 0.091,+ "Newton's second law says: the acceleration of an object equals the net force on it, divided by its mass."+ ],+ [+ 7.982,+ "Double the force, and the acceleration doubles."+ ],+ [+ 11.406,+ "We can also write it the other way around: net force equals mass times acceleration."+ ]+ ]+ },+ "cart": {+ "dur": 11.64,+ "marks": {+ "cart": 3.177,+ "car": 4.675,+ "why": 6.406+ },+ "cues": [+ [+ 0.104,+ "Push a shopping cart and a car with the same force."+ ],+ [+ 3.177,+ "The cart zooms off."+ ],+ [+ 4.675,+ "The car hardly moves."+ ],+ [+ 6.406,+ "The car has much more mass, so the same force gives it much less acceleration."+ ]+ ]+ },+ "calc": {+ "dur": 13.992,+ "marks": {+ "ex": 1.107,+ "f": 6.901,+ "ans": 10.417+ },+ "cues": [+ [+ 0.104,+ "Let's use it."+ ],+ [+ 1.107,+ "A two thousand kilogram car accelerates at three meters per second squared."+ ],+ [+ 6.901,+ "Net force equals mass times acceleration: two thousand times three is six thousand newtons."+ ]+ ]+ },+ "wind": {+ "dur": 14.736,+ "marks": {+ "with": 2.721,+ "against": 9.492+ },+ "cues": [+ [+ 0.104,+ "The direction of the net force matters too."+ ],+ [+ 2.721,+ "Coasting on a bike with the wind at your back, the net force points the same way as your velocity, so you speed up."+ ],+ [+ 9.492,+ "Coasting against the wind, the net force points the other way, so you slow down."+ ]+ ]+ },+ "q3": {+ "dur": 4.368,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.159,+ "Force, mass, and acceleration."+ ]+ ]+ },+ "wrap3": {+ "dur": 18.216,+ "marks": {+ "w1": 0.99,+ "w2": 6.81,+ "w3": 10.104,+ "end": 16.185+ },+ "cues": [+ [+ 0.104,+ "To sum up."+ ],+ [+ 0.99,+ "Newton's second law: acceleration equals net force divided by mass."+ ],+ [+ 6.81,+ "Net force equals mass times acceleration."+ ],+ [+ 10.104,+ "A net force in the direction of motion speeds things up; against it, things slow down."+ ],+ [+ 16.185,+ "Next: Newton's third law."+ ]+ ]+ },+ "part4": {+ "dur": 4.512,+ "marks": {+ "q": 2.539+ },+ "cues": [+ [+ 0.104,+ "Part four."+ ],+ [+ 1.094,+ "Newton's third law."+ ],+ [+ 2.539,+ "Forces always come in pairs."+ ]+ ]+ },+ "law3": {+ "dur": 15.72,+ "marks": {+ "law": 2.096,+ "bowl": 6.523,+ "equal": 10.859,+ "opp": 13.216+ },+ "cues": [+ [+ 0.091,+ "Newton's third law says: for every action, there is an equal and opposite reaction."+ ],+ [+ 6.523,+ "Throw a heavy bowling ball forward, and it pushes you backward."+ ],+ [+ 10.859,+ "The two forces are the same size, but they point in opposite directions."+ ]+ ]+ },+ "pairs": {+ "dur": 13.032,+ "marks": {+ "tramp": 2.565,+ "run": 7.552+ },+ "cues": [+ [+ 0.104,+ "These are called action-reaction pairs."+ ],+ [+ 2.565,+ "Land on a trampoline, and you push down on it."+ ],+ [+ 5.378,+ "It pushes you back up into the air."+ ],+ [+ 7.552,+ "When you run, your foot pushes back on the ground, and the ground pushes you forward."+ ]+ ]+ },+ "earth": {+ "dur": 15.072,+ "marks": {+ "mass": 2.865,+ "tiny": 9.18+ },+ "cues": [+ [+ 0.104,+ "So if you push on Earth, why doesn't Earth move?"+ ],+ [+ 2.865,+ "Remember the second law: the same force gives a huge mass a tiny acceleration."+ ],+ [+ 9.18,+ "Earth is so massive that its acceleration is far too small to notice."+ ],+ [+ 14.115,+ "But it's there."+ ]+ ]+ },+ "q4": {+ "dur": 2.904,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.107,+ "Action and reaction."+ ]+ ]+ },+ "wrap4": {+ "dur": 20.208,+ "marks": {+ "w1": 0.977,+ "w2": 6.732,+ "w3": 13.086,+ "end": 17.865+ },+ "cues": [+ [+ 0.104,+ "To sum up."+ ],+ [+ 0.977,+ "Newton's third law: for every action, there is an equal and opposite reaction."+ ],+ [+ 6.732,+ "The two forces are the same size and point in opposite directions, on two different objects."+ ],+ [+ 13.086,+ "The same force moves a small mass a lot and a huge mass hardly at all."+ ],+ [+ 17.865,+ "Next: the chapter practice."+ ]+ ]+ },+ "final1": {+ "dur": 3.72,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Chapter practice."+ ],+ [+ 1.602,+ "First, force and the first law."+ ]+ ]+ },+ "final2": {+ "dur": 2.088,+ "marks": {},+ "cues": [+ [+ 0.091,+ "Now the second and third laws."+ ]+ ]+ },+ "finish": {+ "dur": 4.128,+ "marks": {},+ "cues": [+ [+ 0.117,+ "That's the whole chapter on force and Newton's laws."+ ],+ [+ 3.229,+ "Well done!"+ ]+ ]+ }+};diff --git a/site/science/ch10/audio/en/wrap1.mp3 b/site/science/ch10/audio/en/wrap1.mp3new file mode 100644index 0000000..b3b2107Binary files /dev/null and b/site/science/ch10/audio/en/wrap1.mp3 differdiff --git a/site/science/ch10/index.html b/site/science/ch10/index.htmlnew file mode 100644index 0000000..b7fc3ec--- /dev/null+++ b/site/science/ch10/index.html@@ -0,0 +1,160 @@+<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<title>Chapter 10: Force and Newton's Laws of Motion — Science</title>+<link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render">+</head>+<body>+<script src="../lib/engine.js"></script>+<script src="../lib/figures.js"></script>+<script src="../lib/physics.js"></script>+<script src="audio/en/timings.js"></script>+<script>+'use strict';+// Chapter 10, one page in book order: part 1 (force, net force, balanced forces, newtons), part 2 (first law: inertia,+// momentum), part 3 (second law), part 4 (third law), then the chapter practice.+const CHAPTER = { number: 10, title: 'Force and Newton’s Laws of Motion', minutes: 13, language: 'en' };+const Q_CARD = { x: 96, y: 586, w: 1408, cls: 'band' }; // a band card under the scenes; it moves up by itself when taller+const GY = 560; // ground line in side-view scenes+const ground = p => { phBlock(p, 0, GY, 1600, 340, PH.grass, { top: 8, ol: 0 }); };+const N = 40; // force arrows: 40 px per newton (scaled per scene where noted)++/* ---------- beats ---------- */+const BEATS = [+/* ---------- part 1: force and net force ---------- */+['intro', 'Force and Newton’s laws', (m, D) => {+ const p = panel(0);+ ground(p);+ const cart = phSprite(p, 'cart', { y: GY }), you = phSprite(p, 'you_point', { y: GY }), f = forceArrow(p);+ clockRun(t => { const x = 260 + 20 * t * t; put(cart, { x: x + 110 }); put(you, { x }); f.set(x + 60, GY - 110, 120, 0, 'push'); }, D);+ const g = G(p, { o: 0, y: 24 });+ T(g, 'Unit 3 · Motion, Forces, and Work · Chapter 10', { x: 800, y: 130, size: 28, fill: COL.dim, anchor: 'middle' });+ phLabel(g, 'Force and Newton’s Laws', { x: 800, y: 240, size: 92, weight: 600 });+ tw(g, { o: 1, y: 0 }, .2, 1.1, out);+ txt(p, 'What makes things start, stop, speed up, or turn?', 800, 320, m('sub'), { size: 36, fill: COL.dim });+}],+['force', 'A push or a pull', (m, D) => {+ const p = panel(0);+ ground(p);+ txt(p, 'A force is a push or a pull', 800, 110, .2, { size: 44 });+ const t1 = m('push'), t2 = m('pull'), ts = m('shape');+ const push = G(p), pull = G(p);+ const c1 = phSprite(push, 'cart', { y: GY }), you = phSprite(push, 'you_point', { y: GY }), f1 = forceArrow(push);+ const c2 = phSprite(pull, 'cart', { y: GY }), fr = phPerson(pull, { role: 'friend', y: GY }), rope = path(pull, '', { stroke: '#c9b38d', 'stroke-width': 5 }), f2 = forceArrow(pull);+ T(push, 'push', { x: 330, y: 200, size: 32, weight: 700, fill: FORCE, anchor: 'middle' });+ T(pull, 'pull', { x: 1100, y: 200, size: 32, weight: 700, fill: FORCE, anchor: 'middle' });+ put(pull, { o: 0 }); show(pull, t2 - .2);+ const sizes = G(p, { o: 0 }), small = forceArrow(sizes), big = forceArrow(sizes);+ small.set(360, 700, 2 * N, 0, '2 N'); big.set(860, 700, 6 * N, 0, '6 N');+ T(sizes, 'longer arrow = bigger force; it points the way of the push or pull', { x: 800, y: 790, size: 30, fill: COL.chalk, anchor: 'middle' });+ show(sizes, m('dir'));+ const can = G(p, { o: 0 }), cs = phSprite(can, 'can', { x: 800, y: 760, s: 2 }), sq1 = forceArrow(can), sq2 = forceArrow(can);+ show(can, ts); hide(sizes, ts - .3, .3); tw(push, { o: .35 }, ts, .4); tw(pull, { o: .35 }, ts, .4);+ txt(p, 'a force can change a shape', 800, 860, ts + .3, { size: 30, fill: COL.chalk });+ clockRun(t => {+ const u = Math.max(0, t - t1), x = 150 + Math.min(250, 30 * u * u);+ put(you, { x }); put(c1, { x: x + 110 }); f1.set(x + 60, GY - 110, t > t1 - .2 ? 110 : 0, 0, '');+ const v = Math.max(0, t - t2), x2 = 1150 + Math.min(260, 28 * v * v);+ put(fr, { x: x2 }); if (v > 0 && x2 < 1410) walkTo(fr, x2); else phPose(fr); put(c2, { x: x2 - 240 });+ rope.setAttribute('d', `M${x2 - 180} ${GY - 50}L${x2 - 12} ${GY - 62}`); f2.set(x2 - 180, GY - 110, t > t2 - .2 ? 110 : 0, 0, '');+ const k = ramp(t, ts + .6, ts + 1.4), w = 60 + 70 * (1 - k);+ phFrame(cs, k >= 1 ? 'can_crushed' : 'can');+ sq1.set(800 - w - 90, 720, 90, 0, ''); sq2.set(800 + w + 90, 720, 90, 180, '');+ }, D);+}],+['net', 'Net force', (m, D) => {+ const p = panel(0);+ ground(p);+ txt(p, 'Net force: the total of all the forces on an object', 800, 110, .2, { size: 40 });+ const c = crate(p, { x: 800, y: GY }), A = forceArrow(p), B = forceArrow(p), NF = forceArrow(p, { color: NETF, w: 14, size: 32 });+ const ta = m('add'), ts = m('sub'), eq1 = runs(p, [['3 N + 2 N = ', COL.chalk], ['5 N →', NETF]], { x: 800, y: 790, size: 44, weight: 700 }),+ eq2 = runs(p, [['5 N − 3 N = ', COL.chalk], ['2 N →', NETF]], { x: 800, y: 790, size: 44, weight: 700 });+ show(eq1, ta + 3); hide(eq1, ts - .2, .2); show(eq2, ts + 3.5);+ txt(p, 'same direction: add · opposite directions: subtract', 800, 860, m('netw'), { size: 30, fill: COL.dim, weight: 500 });+ clockRun(t => {+ const phase = t < ts - .2 ? 1 : 2, u = phase === 1 ? t - ta : t - ts;+ const slide = phase === 1 ? Math.min(60, Math.max(0, u - 3) * 20) : 60 + Math.min(30, Math.max(0, u - 3.5) * 10), x = 800 + slide;+ put(c, { x });+ if (t < ta) { A.set(0, 0, 0); B.set(0, 0, 0); NF.set(0, 0, 0); return; }+ if (phase === 1) { A.set(x + 80, GY - 95, 3 * N, 0, '3 N'); B.set(x + 80, GY - 40, 2 * N, 0, '2 N', 0, 50); NF.set(x - 100, GY + 80, u > 2.5 ? 5 * N : 0, 0, 'net force', 0, 70); }+ else { A.set(x + 80, GY - 70, 5 * N, 0, '5 N'); B.set(x - 80, GY - 70, 3 * N, 180, '3 N'); NF.set(x - 40, GY + 80, u > 3 ? 2 * N : 0, 0, 'net force', 0, 70); }+ }, D);+}, { lead: false }],+['balance', 'Balanced and unbalanced', (m, D) => {+ const p = panel(0);+ ground(p);+ const tb = m('bal'), tu = m('unbal');+ const L = phSprite(p, 'friend_point', { y: GY }), R = phSprite(p, 'you_point', { y: GY }), rope = path(p, '', { stroke: '#c9b38d', 'stroke-width': 7 });+ phFace(R, -1);+ const mark = mk('rect', { x: -6, y: -40, width: 12, height: 40, fill: COL.bad }, G(p)), mg = mark.parentNode;+ path(p, `M800 ${GY + 10}V${GY + 60}`, { stroke: COL.dim, 'stroke-width': 4, 'stroke-dasharray': '6 6' });+ const FL = forceArrow(p), FR = forceArrow(p), NF = forceArrow(p, { color: NETF, w: 14, size: 32 });+ const tag = phLabel(p, '', { x: 800, y: 180, size: 48 });+ clockRun(t => {+ const pull = t < tu ? 10 : 10 + 5 * ramp(t, tu, tu + .8), u = Math.max(0, t - tu - .8), dx = Math.min(140, 20 * u * u);+ put(L, { x: 380 + dx }); put(R, { x: 1160 + dx }); rope.setAttribute('d', `M${430 + dx} ${GY - 70}H${1110 + dx}`); put(mg, { x: 800 + dx, y: GY - 70 + 20 });+ const on = t > tb - .2;+ FL.set(430 + dx, GY - 120, on ? 10 * N * .6 : 0, 180, '10 N'); FR.set(1110 + dx, GY - 120, on ? pull * N * .6 : 0, 0, `${Math.round(pull)} N`);+ NF.set(700 + dx, GY + 110, t > tu + .9 ? 5 * N * .6 : 0, 0, 'net force: 5 N', 0, 60);+ phText(tag, t < tb ? '' : t < tu ? 'balanced: net force = 0 N' : 'unbalanced: net force = 5 N →');+ }, D);+}],+['newton', 'The newton', (m, D) => {+ const p = panel(0);+ txt(p, 'Force is measured in newtons (N)', 800, 110, .2, { size: 44 });+ phSprite(p, 'apple', { x: 520, y: 460, s: 3 });+ const ag = G(p, { o: 0 }); forceArrow(ag).set(520, 600, 125, -90, 'hand: 1 N', -100, 20); forceArrow(ag).set(520, 175, 125, 90, 'gravity: 1 N', 120, 20);+ show(ag, m('apple'));+ txt(p, 'holding up an apple ≈ 1 N', 520, 680, m('apple', .4), { size: 32 });+ const def = G(p, { o: 0 });+ runs(def, [['1 N', FORCE], [' = 1 kg × 1 ', COL.chalk], ['m/s²', ACC]], { x: 1150, y: 330, size: 56, weight: 700, o: 1 });+ T(def, 'the force that gives 1 kg an acceleration of 1 m/s²', { x: 1150, y: 390, size: 26, fill: COL.dim, anchor: 'middle' });+ show(def, m('def'));+ const blk = G(p, { o: 0 }), b = crate(blk, { w: 110, h: 90, label: '1 kg' }), fb = forceArrow(blk), ab = path(blk, '', { stroke: ACC, 'stroke-width': 8 });+ phBlock(blk, 880, 600, 560, 10, PH.walk, { top: 0, ol: 0 });+ show(blk, m('def', .5));+ clockRun(t => { const u = Math.max(0, t - m('def', .8)), x = 940 + Math.min(380, 40 * u * u); put(b, { x, y: 600 }); fb.set(x + 56, 555, 70, 0, '1 N'); arrowAt(ab, x - 40, 480, 80, 0); }, D);+}, { lead: false }],+['q1', 'Quick check', (m, D) => {+ const p = panel(0);+ ground(p);+ const L = phSprite(p, 'friend_point', { x: 420, y: GY }), R = phSprite(p, 'you_point', { x: 1180, y: GY });+ phFace(R, -1);+ path(p, `M470 ${GY - 70}H1130`, { stroke: '#c9b38d', 'stroke-width': 7 });+ forceArrow(p).set(470, GY - 120, 10 * N * .6, 180, 'brother: 10 N'); forceArrow(p).set(1130, GY - 120, 15 * N * .6, 0, 'you: 15 N');+}, { ask: done => quiz(Q_CARD, [+ { id: 'c-tug', prompt: ['Tug-of-war: you pull with 15 newtons, your brother pulls the other way with 10 newtons. What is the ', h('b', '', 'net force'), '?'],+ build: blanks([{ parts: ['net force = 15 − 10 = ', { box: '5' }, ' newtons'], why: 'Opposite directions subtract: 15 − 10 = 5 newtons, toward you.', hint: 'The forces point in opposite directions, so subtract.' }]) },+ { id: 'c-tugdir', prompt: ['Which way does the rope start to move?'],+ build: choice([['toward you'], ['toward your brother'], ['it does not move']], 0,+ 'The net force (5 newtons) points toward you, the stronger pull.',+ [null, 'Your brother pulls with less force; the net force points toward you.', 'The forces are unbalanced (15 vs 10), so the rope moves.']) },+ { id: 'c-bal', prompt: ['Two teams each pull with 20 newtons in opposite directions. These forces are…'],+ build: choice([['balanced: the net force is 0'], ['unbalanced: the net force is 40 newtons']], 0,+ 'Equal and opposite forces cancel: the net force is 0, so nothing changes.',+ [null, 'They point in opposite directions, so subtract: 20 − 20 = 0.']) },+], done) }],+['wrap1', 'Summary · Force', (m, D) => {+ const p = panel(0);+ txt(p, 'Force and net force', 800, 140, .2, { size: 40, fill: COL.dim });+ [['A force is a push or a pull, with a size and a direction.', 'w1'],+ ['Same direction: add. Opposite directions: subtract. The total is the net force.', 'w2'],+ ['Balanced forces cancel out; unbalanced forces change motion.', '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 first law.', 800, 760, m('end'), { size: 32, fill: COL.dim, weight: 500 });+}],+/*BEATS*/+].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));++boot();+</script>+</body>+</html>diff --git a/site/science/img/apple.png b/site/science/img/apple.pngnew file mode 100644index 0000000..8c742e0Binary files /dev/null and b/site/science/img/apple.png differdiff --git a/site/science/img/bike.png b/site/science/img/bike.pngnew file mode 100644index 0000000..de91389Binary files /dev/null and b/site/science/img/bike.png differdiff --git a/site/science/img/can.png b/site/science/img/can.pngnew file mode 100644index 0000000..54a5d24Binary files /dev/null and b/site/science/img/can.png differdiff --git a/site/science/img/can_crushed.png b/site/science/img/can_crushed.pngnew file mode 100644index 0000000..8baed62Binary files /dev/null and b/site/science/img/can_crushed.png differdiff --git a/site/science/img/cart.png b/site/science/img/cart.pngnew file mode 100644index 0000000..d33e804Binary files /dev/null and b/site/science/img/cart.png differdiff --git a/site/science/img/friend_point.png b/site/science/img/friend_point.pngnew file mode 100644index 0000000..164aa80Binary files /dev/null and b/site/science/img/friend_point.png differdiff --git a/site/science/img/rider.png b/site/science/img/rider.pngnew file mode 100644index 0000000..fd1b85cBinary files /dev/null and b/site/science/img/rider.png differdiff --git a/site/science/img/you_point.png b/site/science/img/you_point.pngnew file mode 100644index 0000000..e5d4fe3Binary files /dev/null and b/site/science/img/you_point.png differdiff --git a/site/science/lib/figures.js b/site/science/lib/figures.jsindex 16d5c74..47830de 100644--- a/site/science/lib/figures.js+++ b/site/science/lib/figures.js@@ -47,7 +47,8 @@ const PX = 8; // world px per sprite pixelconst PH_SPR = { car: [32, 13], truck: [44, 24], lamp: [7, 27], tree: [16, 20], house: [18, 14], maya_seated: [7, 7],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] }; // *_top: seen from above, facing east; their origin is the centre (phTop)+ 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)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 phFacediff --git a/site/science/lib/physics.js b/site/science/lib/physics.jsnew file mode 100644index 0000000..9890a55--- /dev/null+++ b/site/science/lib/physics.js@@ -0,0 +1,68 @@+// Papermorph science book: shared lesson helpers for physics chapters (load after engine.js and figures.js).+// Copied from ch09's chapter-local helpers (ch09 keeps its own copies, unchanged).+'use strict';+const txt = (p, s, x, y, t0, { size = 32, fill = COL.chalk, anchor = 'middle', weight = 600 } = {}) => { const e = T(p, s, { x, y, size, fill, anchor, weight, o: 0 }); show(e, t0); return e; };+// One line with coloured runs: [[text, colour?], …].+function runs(p, parts, { x, y, size = 40, anchor = 'middle', weight = 600, o = 0 }) {+ const t = T(p, '', { x, y, size, anchor, weight, o });+ parts.forEach(([s, c]) => { const sp = mk('tspan', { fill: c || COL.chalk }, t); sp.textContent = s; });+ return t;+}+function arrowPath(x1, y, x2) { const d = Math.sign(x2 - x1); return `M${x1} ${y}H${x2}M${x2 - 16 * d} ${y - 11}L${x2} ${y}L${x2 - 16 * d} ${y + 11}`; }+const DIST = COL.rat, TIME = COL.whole; // distance pink (as "change of position" in part 1), time blue+const walkTo = (r, x, step = 22) => phPose(r, 'walk', x / step * Math.PI); // two frames per stride, from x+// A measured track: a bar with ticks every `every` meters from 0 to `to`, U px per meter.+function meterTrack(p, { x0, U, y, to, every, size = 26 }) {+ const g = G(p);+ phBlock(g, x0 - 20, y, U * to + 40, 14, '#8a6f55', { top: 4, ol: 0 });+ for (let v = 0; v <= to; v += every) {+ mk('rect', { x: x0 + U * v - 2, y: y + 14, width: 4, height: 14, fill: COL.dim }, g);+ T(g, String(v), { x: x0 + U * v, y: y + 56, size, fill: COL.chalk, anchor: 'middle' });+ }+ T(g, 'meters', { x: x0 + U * to + 36, y: y + 56, size: size - 2, fill: COL.dim });+ return g;+}+// A fraction in words or numbers (upright text, no math italics), centred on x with its bar at y.+function wfrac(p, top, bot, x, y, { size = 44, ct = COL.chalk, cb = COL.chalk, o = 0 } = {}) {+ const g = G(p, { x, y, o }), w = Math.max(uiW(top, size), uiW(bot, size)) + 24;+ T(g, top, { y: -size * .32, size, fill: ct, anchor: 'middle', weight: 600 });+ mk('rect', { x: -w / 2, y: -2, width: w, height: 4, rx: 2, fill: COL.chalk }, g);+ T(g, bot, { y: size * 1.02, size, fill: cb, anchor: 'middle', weight: 600 });+ g._w = w;+ return g;+}+// A sim clock: stopwatch plus "N s" under it; set(sec) turns the hand (one turn per minute) and writes whole seconds.+function simClock(p, x, y, r = 46) {+ const sw = phStopwatch(p, { x, y, r }), lab = T(p, '0 s', { x, y: y + r + 48, size: 32, weight: 700, fill: TIME, anchor: 'middle' });+ return { sw, lab, set(sec) { put(sw._hand, { r: sec * 6 }); phText(lab, `${Math.floor(sec + 1e-6)} s`); } };+}+const ramp = (t, a, b) => Math.min(1, Math.max(0, (t - a) / (b - a)));+const VEL = COL.int; // velocity arrows and readouts: yellow+// Set path el to an arrow from (x, y), len long, at angle a (degrees; 0 = right, −90 = up).+function arrowAt(el, x, y, len, a, head = 18) {+ const r = a * Math.PI / 180, c = Math.cos(r), s = Math.sin(r), x2 = x + len * c, y2 = y + len * s;+ el.setAttribute('d', len < 2 ? '' : `M${x} ${y}L${x2} ${y2}M${x2 - head * c - head * .6 * s} ${y2 - head * s + head * .6 * c}L${x2} ${y2}L${x2 - head * c + head * .6 * s} ${y2 - head * s - head * .6 * c}`);+ return el;+}+const ACC = '#ee6fd0'; // acceleration: magenta (velocity stays yellow)+const FORCE = '#ff7a45', NETF = COL.chalk; // forces: orange arrows; the net force: a thick white arrow+// A labelled force arrow: f.set(x, y, len, angle, text, dx, dy) draws it from (x, y); the label sits above its middle+// (shifted by dx, dy). len 0 hides it.+function forceArrow(p, { color = FORCE, w = 9, size = 28 } = {}) {+ const g = G(p), a = path(g, '', { stroke: color, 'stroke-width': w }), lab = phLabel(g, '', { size, fill: color });+ return Object.assign(g, {+ set(x, y, len, ang = 0, text = '', dx = 0, dy = 0) {+ const r = ang * Math.PI / 180;+ arrowAt(a, x, y, len, ang, 12 + w); phText(lab, len > 1 ? text : '');+ put(lab, { x: x + len / 2 * Math.cos(r) + dx, y: y + len / 2 * Math.sin(r) - 20 + dy });+ },+ });+}+// A crate (centred on x, sitting on y); returns the group.+function crate(p, { x = 0, y = 0, w = 150, h = 130, label = '' } = {}) {+ const g = G(p, { x, y });+ phBlock(g, -w / 2, -h, w, h, '#a87a4f', { top: 8, right: 14, ol: 0 });+ path(g, `M${-w / 2 + 10} ${-h + 18}L${w / 2 - 24} -10M${-w / 2 + 10} -10L${w / 2 - 24} ${-h + 18}`, { stroke: '#7d5737', 'stroke-width': 8 });+ if (label) phLabel(g, label, { y: -h / 2 + 10, size: 30 });+ return g;+}