{"job_id":"anim-job-7dc9b80e-389a-47c9-8b42-9c8edf80ce59","request_id":"test-physics-shm-1b2ba770-6450-4b1c-a815-8b28db3d7c87-1778704510421","status":"complete","asset":{"primary_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-7dc9b80e-389a-47c9-8b42-9c8edf80ce59/walkthrough.mp4","thumbnail_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-7dc9b80e-389a-47c9-8b42-9c8edf80ce59/thumb.jpg","transcript_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-7dc9b80e-389a-47c9-8b42-9c8edf80ce59/transcript.vtt","interactive_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-7dc9b80e-389a-47c9-8b42-9c8edf80ce59/index.html","scenefile_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-7dc9b80e-389a-47c9-8b42-9c8edf80ce59/scene-source.json","duration_seconds":15,"byte_size":526000,"renderer":"html_three_js_local","parameters":{"style":"auto","executor":"native_render_executor","localPath":"/app/storage/assets/anim-job-7dc9b80e-389a-47c9-8b42-9c8edf80ce59","interactivity":"none","renderer_style":"three_js","durationSeconds":15,"render_manifest":{"jobId":"anim-job-7dc9b80e-389a-47c9-8b42-9c8edf80ce59","request":{"gap":{"topic":"shm-restoring-force","severity":"dangerous","error_type":"concept_misunderstanding","memory_state":"fragile","display_topic":"Simple Harmonic Motion — Restoring Force","common_wrong_answer":"The restoring force in SHM is constant regardless of displacement.","confidence_at_error":"high","correct_understanding":"Restoring force is proportional to displacement: F = -kx. Maximum at extremes, zero at mean position."},"target":{"style":"auto","render":{"fps":30,"format":"mp4","resolution":"1920x1080","include_thumbnail":true,"include_transcript":true},"audience":{"tone":"neutral_instructional","grade":"11","language":"en"},"interactivity":"none","duration_seconds":15},"context":{"chapter":{"name":"Oscillations","ncert_class":11,"ncert_chapter_number":14},"sub_topics":[{"topic":"Simple Harmonic Motion","key_concepts":["SHM","restoring force","amplitude","time period"]}]},"metadata":{"priority":"normal"},"exam_type":"neet","asset_type":"simulation","request_id":"test-physics-shm-1b2ba770-6450-4b1c-a815-8b28db3d7c87-1778704510421","subject_area":"physics"},"renderer":"html_three_js_local","storyboard":{"beats":[{"label":"Topic","visual":"Show the topic title and the key physical context.","narration":"Simple Harmonic Motion — Restoring Force"},{"label":"Mistake","visual":"Show the wrong approach and why it seems plausible.","narration":"The restoring force in SHM is constant regardless of displacement."},{"label":"Correction","visual":"Show the right approach step by step.","narration":"Restoring force is proportional to displacement: F = -kx. Maximum at extremes, zero at mean position."},{"label":"Concept","visual":"Highlight the key formula and the governing relationship.","narration":"SHM. restoring force. amplitude"}],"title":"Simple Harmonic Motion — Restoring Force","sceneCode":"<!doctype html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\"/>\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>\n  <title>SHM Restoring Force — Why It Changes</title>\n  <style>\n    :root{--bg:#0f1418;--panel:#182228;--line:#2e3e46;--accent:#e5ba67;--text:#f4f1ea;--muted:#c8d4da;--blue:#63b3ff;--green:#87e8a8;--red:#de7f76;}\n    *{box-sizing:border-box;}\n    body{margin:0;font-family:\"Plus Jakarta Sans\",\"Manrope\",ui-sans-serif,system-ui,sans-serif;background:radial-gradient(120% 90% at 20% -5%,#24343d 0%,var(--bg) 55%);color:var(--text);}\n    main{min-height:100vh;display:grid;grid-template-columns:minmax(300px,380px) 1fr;}\n    aside{border-right:1px solid var(--line);background:linear-gradient(180deg,rgba(31,46,53,.86),rgba(24,34,40,.92));padding:24px;overflow:auto;backdrop-filter:blur(6px);}\n    section{padding:24px;display:grid;place-items:center;}\n    h1{margin:0 0 10px;font-size:1.65rem;line-height:1.15;}\n    .sub{margin:0 0 16px;color:var(--muted);}\n    .formula{margin:0 0 14px;padding:10px;border:1px solid var(--line);border-radius:10px;background:#11191e;color:var(--accent);font-family:ui-monospace,monospace;font-size:0.9rem;box-shadow:inset 0 0 28px rgba(229,186,103,.08);}\n    .control{display:grid;gap:6px;margin:12px 0;}\n    .control input{width:100%;accent-color:var(--accent);}\n    ul{margin:14px 0 0 18px;padding:0;color:var(--muted);display:grid;gap:6px;}\n    .stage{width:min(1020px,95%);aspect-ratio:16/9;border:1px solid #445862;border-radius:14px;position:relative;overflow:hidden;background:radial-gradient(circle at 50% 38%,#2f4a57,#0f1418 72%);box-shadow:0 18px 60px rgba(0,0,0,.45), inset 0 0 90px rgba(255,255,255,.03);}\n    .stage::before{content:\"\";position:absolute;inset:0;background:linear-gradient(180deg,rgba(255,255,255,.06),transparent 34%);pointer-events:none;}\n    .legend{position:absolute;right:12px;top:12px;padding:8px 10px;border-radius:10px;border:1px solid #465a64;background:rgba(9,14,18,.58);font-size:0.8rem;color:var(--muted);backdrop-filter:blur(4px);}\n    @media(max-width:900px){main{grid-template-columns:1fr;}aside{border-right:0;border-bottom:1px solid var(--line);}}\n  </style>\n</head>\n<body>\n<main>\n  <aside>\n    <h1>SHM Restoring Force</h1>\n    <p class=\"sub\">Why force is NOT constant—it depends on displacement.</p>\n    <p class=\"formula\">F = −kx</p>\n    <label class=\"control\"><span>Spring Constant k: <strong id=\"v-k\">150</strong> N/m</span><input id=\"c-k\" type=\"range\" min=\"50\" max=\"300\" step=\"10\" value=\"150\"/></label>\n    <label class=\"control\"><span>Amplitude A: <strong id=\"v-amp\">0.15</strong> m</span><input id=\"c-amp\" type=\"range\" min=\"0.08\" max=\"0.25\" step=\"0.01\" value=\"0.15\"/></label>\n    <label class=\"control\"><span>Mass m: <strong id=\"v-m\">0.5</strong> kg</span><input id=\"c-m\" type=\"range\" min=\"0.2\" max=\"1.0\" step=\"0.1\" value=\"0.5\"/></label>\n    <ul>\n      <li><strong style=\"color:var(--red)\">❌ Myth:</strong> Force stays the same</li>\n      <li><strong style=\"color:var(--green)\">✓ Truth:</strong> Force ∝ displacement</li>\n      <li>At extremes: |F| is maximum</li>\n      <li>At center: F = 0</li>\n      <li>Watch the force arrow change length</li>\n    </ul>\n  </aside>\n  <section>\n    <div class=\"stage\" id=\"stage\">\n      <div class=\"legend\" id=\"legend\">Ready</div>\n      <canvas id=\"sim-cv\" style=\"position:absolute;inset:0;width:100%;height:100%;\"></canvas>\n    </div>\n  </section>\n</main>\n<script>\nconst controls = [{\"key\":\"k\",\"label\":\"Spring Constant\",\"min\":50,\"max\":300,\"step\":10,\"value\":150,\"units\":\"N/m\"},{\"key\":\"amp\",\"label\":\"Amplitude\",\"min\":0.08,\"max\":0.25,\"step\":0.01,\"value\":0.15,\"units\":\"m\"},{\"key\":\"m\",\"label\":\"Mass\",\"min\":0.2,\"max\":1.0,\"step\":0.1,\"value\":0.5,\"units\":\"kg\"}];\nfor(const c of controls){\n  const inp=document.getElementById('c-'+c.key);\n  const out=document.getElementById('v-'+c.key);\n  inp?.addEventListener('input',()=>{out.textContent=inp.value;window.updateModel?.();});\n}\n(function(){\n  const cv=document.getElementById('sim-cv');\n  const ctx=cv.getContext('2d');\n  function resize(){const r=cv.getBoundingClientRect();if(r.width>0){cv.width=r.width;cv.height=r.height;}}\n  resize();new ResizeObserver(resize).observe(cv);\n  let lastTs=0;\n  \n  function glowDot(x,y,r,color,a){\n    const g=ctx.createRadialGradient(x,y,0,x,y,r*2.6);\n    g.addColorStop(0,color.replace('ALPHA',String(a)));\n    g.addColorStop(1,color.replace('ALPHA','0'));\n    ctx.fillStyle=g;ctx.beginPath();ctx.arc(x,y,r*2.6,0,Math.PI*2);ctx.fill();\n  }\n  \n  function arrow(x1,y1,x2,y2,color,label=''){\n    const dx=x2-x1,dy=y2-y1,l=Math.sqrt(dx*dx+dy*dy);\n    if(l<2)return;\n    const nx=dx/l,ny=dy/l,s=12;\n    ctx.strokeStyle=color;ctx.lineWidth=3;ctx.beginPath();ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.stroke();\n    ctx.fillStyle=color;ctx.beginPath();\n    ctx.moveTo(x2,y2);\n    ctx.lineTo(x2-s*nx+s*0.4*ny,y2-s*ny-s*0.4*nx);\n    ctx.lineTo(x2-s*nx-s*0.4*ny,y2-s*ny+s*0.4*nx);\n    ctx.fill();\n    if(label){\n      ctx.fillStyle=color;ctx.font=Math.round(cv.height*0.035)+'px sans-serif';\n      ctx.textAlign='center';ctx.fillText(label,x1+dx*0.5-20,y1+dy*0.5-8);\n    }\n  }\n  \n  // State variables\n  let phase=0;\n  let x=0; // displacement\n  let v=0; // velocity\n  let force=0; // restoring force\n  let forceHist=[];\n  let xHist=[];\n  \n  function tick(ts){\n    const dt=Math.min(0.04,(ts-lastTs)/1000);lastTs=ts;\n    const W=cv.width,H=cv.height;\n    \n    // Read sliders\n    const k=Number(document.getElementById('c-k').value);\n    const amp=Number(document.getElementById('c-amp').value);\n    const m=Number(document.getElementById('c-m').value);\n    const omega=Math.sqrt(k/m);\n    \n    // Update phase\n    phase+=(omega*dt);\n    \n    // SHM: x(t) = A*cos(ωt)\n    x=amp*Math.cos(phase);\n    v=-amp*omega*Math.sin(phase); // velocity: dx/dt\n    force=-k*x; // CORRECT: F = -kx\n    \n    // History for plotting\n    xHist.push(x);forceHist.push(force);\n    if(xHist.length>120)xHist.shift(),forceHist.shift();\n    \n    // Clear\n    ctx.clearRect(0,0,W,H);\n    \n    // ===== Layer 1: Background grid & reference =====\n    ctx.strokeStyle='#2e3e46';ctx.lineWidth=1;\n    ctx.beginPath();ctx.moveTo(W*0.5,0);ctx.lineTo(W*0.5,H);ctx.stroke(); // equilibrium line\n    ctx.fillStyle='#3a4d5a';ctx.font=Math.round(H*0.03)+'px sans-serif';\n    ctx.textAlign='center';ctx.fillText('Equilibrium (x=0)',W*0.5,H*0.04);\n    \n    // ===== Layer 2: Main SHM oscillator (left side, x-scale) =====\n    const oscX=W*0.25;\n    const oscY=H*0.55;\n    const xScale=W*0.12; // pixels per meter\n    \n    // Draw spring-like track\n    ctx.strokeStyle='#465a64';ctx.lineWidth=2;ctx.setLineDash([4,4]);\n    ctx.beginPath();ctx.moveTo(oscX-xScale*amp*1.1,oscY);ctx.lineTo(oscX+xScale*amp*1.1,oscY);ctx.stroke();\n    ctx.setLineDash([]);\n    \n    // Draw equilibrium marker\n    ctx.fillStyle='#3a4d5a';ctx.beginPath();ctx.arc(oscX,oscY,6,0,Math.PI*2);ctx.fill();\n    \n    // Draw mass ball at current position\n    const ballX=oscX+x*xScale;\n    glowDot(ballX,oscY,10,'rgba(99,179,255,ALPHA)',0.8);\n    ctx.fillStyle='#63b3ff';ctx.beginPath();ctx.arc(ballX,oscY,8,0,Math.PI*2);ctx.fill();\n    \n    // Draw restoring force arrow (from ball toward equilibrium)\n    const forcePixels=force*xScale; // convert force to screen pixels\n    if(Math.abs(forcePixels)>1){\n      const arrowColor=force<0?'#de7f76':'#87e8a8';\n      arrow(ballX,oscY+25,ballX+forcePixels,oscY+25,arrowColor,'F');\n    }\n    \n    // Draw displacement annotation\n    ctx.strokeStyle='#e5ba67';ctx.lineWidth=1.5;ctx.setLineDash([2,2]);\n    ctx.beginPath();ctx.moveTo(oscX,oscY);ctx.lineTo(ballX,oscY);ctx.stroke();\n    ctx.setLineDash([]);\n    ctx.fillStyle='#e5ba67';ctx.font=Math.round(H*0.032)+'px sans-serif';\n    ctx.textAlign='left';ctx.fillText('x = '+x.toFixed(3)+'m',ballX+5,oscY-15);\n    \n    // Force magnitude label\n    const fMag=Math.abs(force).toFixed(2);\n    ctx.fillStyle='#de7f76';ctx.textAlign='left';ctx.fillText('|F| = '+fMag+'N',ballX+5,oscY+50);\n    \n    // ===== Layer 3: Force vs Displacement Graph (right side) =====\n    const graphX=W*0.68;const graphY=H*0.5;\n    const gW=W*0.26;const gH=H*0.35;\n    \n    // Draw graph border\n    ctx.strokeStyle='#465a64';ctx.lineWidth=1.5;\n    ctx.strokeRect(graphX-gW*0.5,graphY-gH*0.5,gW,gH);\n    ctx.fillStyle='rgba(30,46,53,0.4)';ctx.fillRect(graphX-gW*0.5,graphY-gH*0.5,gW,gH);\n    \n    // Graph title\n    ctx.fillStyle='#e5ba67';ctx.font=Math.round(H*0.035)+'px sans-serif';\n    ctx.textAlign='center';ctx.fillText('F vs x',graphX,graphY-gH*0.5-8);\n    \n    // Theoretical F=-kx line (blue)\n    ctx.strokeStyle='#63b3ff';ctx.lineWidth=2;ctx.globalAlpha=0.7;\n    ctx.beginPath();\n    for(let i=-amp;i<=amp;i+=0.01){\n      const fTheo=-k*i;\n      const px=graphX-gW*0.5+((i+amp)/(amp*2))*gW;\n      const py=graphY+(fTheo/(k*amp))*gH*0.45;\n      if(i===-amp)ctx.moveTo(px,py);\n      else ctx.lineTo(px,py);\n    }ctx.stroke();ctx.globalAlpha=1;\n    \n    // Live history dots\n    ctx.fillStyle='#87e8a8';\n    for(let i=0;i<xHist.length;i++){\n      if(i%8===0){\n        const px=graphX-gW*0.5+((xHist[i]+amp)/(amp*2))*gW;\n        const py=graphY+(forceHist[i]/(k*amp))*gH*0.45;\n        ctx.beginPath();ctx.arc(px,py,3,0,Math.PI*2);ctx.fill();\n      }\n    }\n    \n    // Current point highlight\n    const pxNow=graphX-gW*0.5+((x+amp)/(amp*2))*gW;\n    const pyNow=graphY+(force/(k*amp))*gH*0.45;\n    glowDot(pxNow,pyNow,8,'rgba(135,232,168,ALPHA)',1);\n    ctx.fillStyle='#87e8a8';ctx.beginPath();ctx.arc(pxNow,pyNow,5,0,Math.PI*2);ctx.fill();\n    \n    // Axes labels\n    ctx.fillStyle='#c8d4da';ctx.font=Math.round(H*0.028)+'px sans-serif';\n    ctx.textAlign='center';ctx.fillText('x (m)',graphX,graphY+gH*0.5+20);\n    ctx.save();ctx.translate(graphX-gW*0.5-18,graphY);ctx.rotate(-Math.PI*0.5);\n    ctx.textAlign='center';ctx.fill","remediationGoal":"Close concept_misunderstanding for physics."},"rendererStyle":"three_js"}}},"metadata":{"rendered_at":"2026-05-13T20:41:17.495Z","cache_hit":false,"cost_usd":0},"error":null}