{"job_id":"anim-job-1ee130f4-e0db-4a34-9a47-10f21f83eff7","request_id":"test-physics-thermo-fef4a9a4-ee3c-4109-9b59-ca80c158fc36-1778702709883","status":"complete","asset":{"primary_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-1ee130f4-e0db-4a34-9a47-10f21f83eff7/walkthrough.mp4","thumbnail_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-1ee130f4-e0db-4a34-9a47-10f21f83eff7/thumb.jpg","transcript_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-1ee130f4-e0db-4a34-9a47-10f21f83eff7/transcript.vtt","interactive_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-1ee130f4-e0db-4a34-9a47-10f21f83eff7/index.html","scenefile_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-1ee130f4-e0db-4a34-9a47-10f21f83eff7/scene-source.json","duration_seconds":15,"byte_size":272385,"renderer":"html_three_js_local","parameters":{"style":"auto","executor":"native_render_executor","localPath":"/app/storage/assets/anim-job-1ee130f4-e0db-4a34-9a47-10f21f83eff7","interactivity":"none","renderer_style":"three_js","durationSeconds":15,"render_manifest":{"jobId":"anim-job-1ee130f4-e0db-4a34-9a47-10f21f83eff7","request":{"gap":{"topic":"pv-diagram-work","severity":"moderate","error_type":"formula_misuse","memory_state":"fragile","display_topic":"PV Diagram — Work Done by Gas","common_wrong_answer":"Work done by gas is always the product of pressure and volume change, regardless of process path.","confidence_at_error":"high","correct_understanding":"Work done = area under the PV curve. Different processes (isothermal, adiabatic, isobaric) give different areas and hence different work."},"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":"Thermodynamics","ncert_class":11,"ncert_chapter_number":12},"sub_topics":[{"topic":"Thermodynamic Processes","key_concepts":["PV diagram","isothermal","adiabatic","work done by gas"]}]},"metadata":{"priority":"normal"},"exam_type":"neet","asset_type":"simulation","request_id":"test-physics-thermo-fef4a9a4-ee3c-4109-9b59-ca80c158fc36-1778702709883","subject_area":"physics"},"renderer":"html_three_js_local","storyboard":{"beats":[{"label":"Topic","visual":"Show the topic title and the key physical context.","narration":"PV Diagram — Work Done by Gas"},{"label":"Mistake","visual":"Show the wrong approach and why it seems plausible.","narration":"Work done by gas is always the product of pressure and volume change, regardless of process path."},{"label":"Correction","visual":"Show the right approach step by step.","narration":"Work done = area under the PV curve. Different processes (isothermal, adiabatic, isobaric) give different areas and hence different work."},{"label":"Concept","visual":"Highlight the key formula and the governing relationship.","narration":"PV diagram. isothermal. adiabatic"}],"title":"PV Diagram — Work Done by Gas","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>PV Diagram — Work Done by Gas</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>PV Diagram Work</h1>\n    <p class=\"sub\">Understand why work ≠ P·ΔV always</p>\n    <p class=\"formula\">W = ∫P dV = Area under curve</p>\n    <label class=\"control\"><span>Process Type: <strong id=\"v-process\">0</strong></span><input id=\"c-process\" type=\"range\" min=\"0\" max=\"2\" step=\"1\" value=\"0\"/></label>\n    <label class=\"control\"><span>Animation Speed: <strong id=\"v-speed\">1.0</strong>×</span><input id=\"c-speed\" type=\"range\" min=\"0.3\" max=\"2\" step=\"0.1\" value=\"1.0\"/></label>\n    <ul>\n      <li><strong>❌ Mistake:</strong> W = P·ΔV (ignores path)</li>\n      <li><strong>✓ Fix:</strong> W = area under PV curve</li>\n      <li><strong>Why:</strong> Different processes expand differently</li>\n      <li><strong>Path matters:</strong> Isothermal ≠ Isobaric ≠ Adiabatic</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\":\"process\",\"label\":\"Process Type\",\"min\":0,\"max\":2,\"step\":1,\"value\":0,\"units\":\"\"},{\"key\":\"speed\",\"label\":\"Animation Speed\",\"min\":0.3,\"max\":2,\"step\":0.1,\"value\":1.0,\"units\":\"×\"}];\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',()=>{\n    if(c.key==='process'){\n      const names=['Isothermal (T const)','Isobaric (P const)','Adiabatic (PV^γ const)'];\n      out.textContent=names[inp.value];\n    } else {\n      out.textContent=inp.value;\n    }\n    window.updateModel?.();\n  });\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,w){\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=w||2;ctx.beginPath();\n    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  }\n\n  // State\n  let phase=0; // 0..1 animation cycle\n  let processType=0;\n  let speed=1.0;\n  let p1=2.0, v1=1.0; // initial state\n  let p2=1.0, v2=2.0; // final state\n  \n  function getStateAtPhase(ph,procType){\n    // ph goes 0→1 over animation\n    if(procType===0){ // Isothermal: PV=const\n      const v=v1+(v2-v1)*ph;\n      const p=p1*v1/v; // isothermal\n      return {p,v};\n    } else if(procType===1){ // Isobaric: P=const\n      const p=p1;\n      const v=v1+(v2-v1)*ph;\n      return {p,v};\n    } else { // Adiabatic: PV^1.4=const\n      const gamma=1.4;\n      const v=v1+(v2-v1)*ph;\n      const p=p1*Math.pow(v1/v,gamma);\n      return {p,v};\n    }\n  }\n\n  function computeWork(procType){\n    // Numerical integration\n    const steps=100;\n    let work=0;\n    for(let i=0;i<steps;i++){\n      const t1=i/steps;\n      const t2=(i+1)/steps;\n      const st1=getStateAtPhase(t1,procType);\n      const st2=getStateAtPhase(t2,procType);\n      const pAvg=(st1.p+st2.p)/2;\n      const dv=(st2.v-st1.v)*(v2-v1); // normalize to actual dV\n      work+=pAvg*dv;\n    }\n    return work;\n  }\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    processType=parseInt(document.getElementById('c-process').value);\n    speed=parseFloat(document.getElementById('c-speed').value);\n    \n    phase+=dt*0.6*speed; // 15-second cycle\n    if(phase>1)phase=0;\n    \n    const curState=getStateAtPhase(phase,processType);\n    const curP=curState.p;\n    const curV=curState.v;\n    \n    // Compute work\n    const totalWork=computeWork(processType);\n    const currentWork=computeWork(processType)*phase; // proportional to phase\n\n    ctx.clearRect(0,0,W,H);\n    \n    // Draw background grid\n    ctx.strokeStyle='rgba(78,112,132,0.15)';\n    ctx.lineWidth=1;\n    const gridSpacing=W*0.1;\n    for(let x=0;x<W;x+=gridSpacing){\n      ctx.beginPath();ctx.moveTo(x,0);ctx.lineTo(x,H);ctx.stroke();\n    }\n    for(let y=0;y<H;y+=gridSpacing){\n      ctx.beginPath();ctx.moveTo(0,y);ctx.lineTo(W,y);ctx.stroke();\n    }\n    \n    // PV diagram area: left 60% of canvas\n    const diag_x=W*0.08;\n    const diag_y=H*0.15;\n    const diag_w=W*0.50;\n    const diag_h=H*0.70;\n    \n    // Axes\n    ctx.strokeStyle='#c8d4da';ctx.lineWidth=2;\n    ctx.beginPath();ctx.moveTo(diag_x,diag_y+diag_h);ctx.lineTo(diag_x+diag_w,diag_y+diag_h);ctx.stroke();\n    ctx.beginPath();ctx.moveTo(diag_x,diag_y);ctx.lineTo(diag_x,diag_y+diag_h);ctx.stroke();\n    \n    // Axis labels\n    ctx.fillStyle='var(--text)';ctx.font=Math.round(H*0.035)+'px sans-serif';\n    ctx.textAlign='center';ctx.fillText('Volume (V)',diag_x+diag_w/2,diag_y+diag_h+H*0.06);\n    ctx.save();ctx.translate(diag_x-H*0.08,diag_y+diag_h/2);ctx.rotate(-Math.PI/2);\n    ctx.textAlign='center';ctx.fillText('Pressure (P)',0,0);ctx.restore();\n    \n    // Plot all three process curves faintly\n    const processNames=['Isothermal','Isobaric','Adiabatic'];\n    const processColors=['#63b3ff','#87e8a8','#de7f76'];\n    \n    for(let proc=0;proc<3;proc++){\n      const col=processColors[proc];\n      ctx.strokeStyle=proc===processType ? col : col+'40';\n      ctx.globalAlpha=proc===processType ? 1 : 0.3;\n      ctx.lineWidth=proc===processType ? 3 : 1.5;\n      ctx.beginPath();\n      for(let i=0;i<=50;i++){\n        const ph=i/50;\n        const st=getStateAtPhase(ph,proc);\n        const px=diag_x+diag_w*(st.v-v1)/(v2-v1);\n        const py=diag_y+diag_h*(1-(st.p-p2)/(p1-p2));\n        if(i===0)ctx.moveTo(px,py);\n        else ctx.lineTo(px,py);\n      }\n      ctx.stroke();\n    }\n    ctx.globalAlpha=1;\n    \n    // Fill area under current process\n    ctx.fillStyle=processColors[processType]+'33';\n    ctx.beginPath();\n    const bx=diag_x+diag_w*(v1-v1)/(v2-v1);\n    const by=diag_y+diag_h*(1-(p1-p2)/(p1-p2));\n    ctx.moveTo(bx,by+diag_h);\n    for(let i=0;i<=50*phase;i++){\n      const ph=i/(50);\n      if(ph>phase)break;\n      const st=getStateAtPhase(ph,processType);\n      const px=diag_x+diag_w*(st.v-v1)/(v2-v1);\n      const py=diag_y+diag_h*(1-(st.p-p2)/(p1-p2));\n      ctx.lineTo(px,py);\n    }\n    ctx.lineTo(diag_x+diag_w*phase,diag_y+diag_h);\n    ctx.fill();\n    \n    // Current point on curve\n    const cur_px=diag_x+diag_w*(curV-v1)/(v2-v1);\n    const cur_py=diag_y+diag_h*(1-(curP-p2)/(p1-p2));\n    glowDot(cur_px,cur_py,6,processColors[processType],0.8);\n    ctx.fillStyle=processColors[processType];ctx.beginPath();\n    ctx.arc(cur_px,cur_py,4,0,Math.PI*2);ctx.fill();\n    \n    // Start/end points\n    ctx.fillStyle='#c8d4da';ctx.beginPath();\n    ctx.arc(diag_x,diag_y+diag_h,3.5,0,Math.PI*2);ctx.fill();\n    ctx.fillStyle='#e5ba67';ctx.beginPath();\n    ctx.arc(diag_x+diag_w,diag_y+diag_h*0.3,3.5,0,Math.PI*2);ctx.fill();\n    \n    // Right panel: comparison\n    const cmp_x=W*0.62;\n    const cmp_w=W*0.33;\n    \n    ctx.fillStyle='#11191e';ctx.fillRect(cmp_x-10,","remediationGoal":"Close formula_misuse for physics."},"rendererStyle":"three_js"}}},"metadata":{"rendered_at":"2026-05-13T20:11:03.452Z","cache_hit":false,"cost_usd":0},"error":null}