{"job_id":"anim-job-c19b88b1-6b45-4752-9432-dd091dc9fbe6","request_id":"bulk-2026-05-20T10-21-44-856Z-10-physics.10.light.snells-law","status":"complete","asset":{"primary_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-c19b88b1-6b45-4752-9432-dd091dc9fbe6/walkthrough.mp4","thumbnail_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-c19b88b1-6b45-4752-9432-dd091dc9fbe6/thumb.jpg","transcript_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-c19b88b1-6b45-4752-9432-dd091dc9fbe6/transcript.vtt","interactive_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-c19b88b1-6b45-4752-9432-dd091dc9fbe6/index.html","scenefile_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-c19b88b1-6b45-4752-9432-dd091dc9fbe6/scene-source.json","duration_seconds":15,"byte_size":476146,"renderer":"html_three_js_local","parameters":{"style":"auto","executor":"native_render_executor","localPath":"/app/storage/assets/anim-job-c19b88b1-6b45-4752-9432-dd091dc9fbe6","interactivity":"none","renderer_style":"three_js","durationSeconds":15,"render_manifest":{"jobId":"anim-job-c19b88b1-6b45-4752-9432-dd091dc9fbe6","request":{"gap":{"topic":"snell-refraction-angle","severity":"moderate","error_type":"formula_misuse","memory_state":"fragile","display_topic":"Snell's Law — Refraction at Interface","common_wrong_answer":"Refracted ray bends away from normal when going from rare to dense medium.","confidence_at_error":"high","correct_understanding":"Going from rare to dense medium (n1 < n2) the ray bends toward the normal: n1 sin θ1 = n2 sin θ2."},"target":{"style":"auto","render":{"fps":30,"format":"mp4","resolution":"1920x1080","include_thumbnail":true,"include_transcript":true},"audience":{"tone":"neutral_instructional","grade":"10","language":"en"},"interactivity":"none","duration_seconds":15},"context":{"chapter":{"name":"Ray Optics","ncert_class":10},"sub_topics":[{"topic":"snell-refraction-angle","key_concepts":["Snell's law","refractive index","critical angle","total internal reflection"]}]},"metadata":{"priority":"normal","trace_id":"bulk-run-2026-05-20T10-21-44-856Z"},"exam_type":"neet","asset_type":"simulation","request_id":"bulk-2026-05-20T10-21-44-856Z-10-physics.10.light.snells-law","subject_area":"physics"},"renderer":"html_three_js_local","storyboard":{"beats":[{"label":"Topic","visual":"Show the topic title and the key physical context.","narration":"Snell's Law — Refraction at Interface"},{"label":"Mistake","visual":"Show the wrong approach and why it seems plausible.","narration":"Refracted ray bends away from normal when going from rare to dense medium."},{"label":"Correction","visual":"Show the right approach step by step.","narration":"Going from rare to dense medium (n1 < n2) the ray bends toward the normal: n1 sin θ1 = n2 sin θ2."},{"label":"Concept","visual":"Highlight the key formula and the governing relationship.","narration":"Snell's law. refractive index. critical angle"}],"title":"Snell's Law — Refraction at Interface","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>Snell's Law Refraction Remediation</title>\n  <style>\n    :root{--bg:#0e121a;--panel:#1c232e;--line:#303449;--accent:#fc884f;--text:#faf9f8;--muted:#9f9ea1;--blue:#627da5;--green:#8decb0;--red:#df8279;}\n    *{box-sizing:border-box;}\n    body{margin:0;font-family:\"Plus Jakarta Sans\",\"Manrope\",\"Inter\",ui-sans-serif,system-ui,sans-serif;background:radial-gradient(120% 90% at 20% -5%,#1c232e 0%,#0e121a 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(28,35,46,.86),rgba(14,18,26,.94));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    li{margin:4px 0;}\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    .icon{display:inline-block;width:18px;height:18px;margin-right:6px;vertical-align:middle;}\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>Snell's Law Refraction</h1>\n    <p class=\"sub\">Rare to Dense: Bend Toward Normal</p>\n    <p class=\"formula\">n₁ sin θ₁ = n₂ sin θ₂</p>\n    \n    <label class=\"control\"><span>Incident Angle: <strong id=\"v-angle\">35</strong>°</span><input id=\"c-angle\" type=\"range\" min=\"15\" max=\"75\" step=\"5\" value=\"35\"/></label>\n    \n    <label class=\"control\"><span>Refractive Index (n₂): <strong id=\"v-n2\">1.5</strong></span><input id=\"c-n2\" type=\"range\" min=\"1.0\" max=\"2.5\" step=\"0.1\" value=\"1.5\"/></label>\n    \n    <label class=\"control\"><span>Animation Speed: <strong id=\"v-speed\">1.0</strong>x</span><input id=\"c-speed\" type=\"range\" min=\"0.5\" max=\"2.0\" step=\"0.1\" value=\"1.0\"/></label>\n\n    <ul>\n      <li><svg class=\"icon\" viewBox=\"0 0 24 24\" style=\"fill:#df8279;\"><circle cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" stroke-width=\"2\" fill=\"none\"/><text x=\"12\" y=\"15\" font-size=\"14\" text-anchor=\"middle\" font-weight=\"bold\">✗</text></svg><strong>Misconception:</strong> Ray bends away</li>\n      <li><svg class=\"icon\" viewBox=\"0 0 24 24\" style=\"fill:#8decb0;\"><circle cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" stroke-width=\"2\" fill=\"none\"/><text x=\"12\" y=\"15\" font-size=\"14\" text-anchor=\"middle\" font-weight=\"bold\">✓</text></svg><strong>Truth:</strong> Ray bends toward normal</li>\n      <li><strong>Why:</strong> Denser medium slows light more → smaller angle</li>\n      <li><strong>Formula:</strong> Lower n₁ means lower θ₂ must follow</li>\n    </ul>\n  </aside>\n  \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\n<script>\nconst controls = [\n  {\"key\":\"angle\",\"label\":\"Incident Angle\",\"min\":15,\"max\":75,\"step\":5,\"value\":35,\"units\":\"°\"},\n  {\"key\":\"n2\",\"label\":\"Refractive Index\",\"min\":1.0,\"max\":2.5,\"step\":0.1,\"value\":1.5,\"units\":\"\"},\n  {\"key\":\"speed\",\"label\":\"Animation Speed\",\"min\":0.5,\"max\":2.0,\"step\":0.1,\"value\":1.0,\"units\":\"x\"}\n];\n\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    out.textContent=inp.value;\n    window.updateModel?.();\n  });\n}\n\n(function(){\n  const cv=document.getElementById('sim-cv');\n  const ctx=cv.getContext('2d');\n  function resize(){\n    const r=cv.getBoundingClientRect();\n    if(r.width>0){\n      cv.width=r.width;\n      cv.height=r.height;\n    }\n  }\n  resize();\n  new ResizeObserver(resize).observe(cv);\n\n  let lastTs=0;\n  let rayProgress=0;\n  let showCorrect=false;\n  let cycleTime=0;\n\n  // State: position of light ray trace\n  let trailCorrect=[];\n  let trailWrong=[];\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;\n    ctx.beginPath();\n    ctx.arc(x,y,r*2.6,0,Math.PI*2);\n    ctx.fill();\n  }\n\n  function trail(points,color){\n    if(points.length<2)return;\n    ctx.strokeStyle=color;\n    ctx.lineWidth=2;\n    ctx.globalAlpha=0.4;\n    ctx.beginPath();\n    ctx.moveTo(points[0].x,points[0].y);\n    for(let i=1;i<points.length;i++){\n      ctx.lineTo(points[i].x,points[i].y);\n    }\n    ctx.stroke();\n    ctx.globalAlpha=1;\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;\n    ctx.lineWidth=w||2;\n    ctx.beginPath();\n    ctx.moveTo(x1,y1);\n    ctx.lineTo(x2,y2);\n    ctx.stroke();\n    ctx.fillStyle=color;\n    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  function tick(ts){\n    const dt=Math.min(0.04,(ts-lastTs)/1000);\n    lastTs=ts;\n    const W=cv.width,H=cv.height;\n\n    // Read sliders\n    const incidentAngleDeg=Number(document.getElementById('c-angle').value);\n    const n2=Number(document.getElementById('c-n2').value);\n    const speedMult=Number(document.getElementById('c-speed').value);\n    const n1=1.0; // air\n\n    // Convert to radians\n    const theta1=incidentAngleDeg*Math.PI/180;\n    // Snell's law: n1*sin(theta1) = n2*sin(theta2)\n    const sinTheta2=n1*Math.sin(theta1)/n2;\n    const theta2=Math.asin(Math.min(1,sinTheta2)); // clamp to avoid NaN\n\n    // Animation cycle\n    cycleTime+=dt*speedMult;\n    if(cycleTime>8){cycleTime=0;showCorrect=false;trailCorrect=[];trailWrong=[];}\n    if(cycleTime>3)showCorrect=true;\n\n    rayProgress=(cycleTime%3)/3; // 0 to 1 over 3 seconds\n    if(rayProgress>1)rayProgress=1;\n\n    // Interface position\n    const interfaceY=H*0.55;\n    const centerX=W*0.5;\n\n    // === Draw background layers ===\n    ctx.fillStyle='#0f1418';\n    ctx.fillRect(0,0,W,interfaceY);\n    \n    ctx.fillStyle='#1a2a32';\n    ctx.fillRect(0,interfaceY,W,H-interfaceY);\n\n    // Medium labels\n    ctx.fillStyle=var(--blue);\n    ctx.font=Math.round(H*0.035)+'px sans-serif';\n    ctx.fillText('n₁ = 1.0 (Air)',24,32);\n    ctx.fillText('n₂ = '+n2.toFixed(1)+' (Dense)',24,H-20);\n\n    // === Draw interface with glow ===\n    ctx.strokeStyle='#445862';\n    ctx.lineWidth=1;\n    ctx.setLineDash([6,4]);\n    ctx.beginPath();\n    ctx.moveTo(0,interfaceY);\n    ctx.lineTo(W,interfaceY);\n    ctx.stroke();\n    ctx.setLineDash([]);\n\n    // Interface glow\n    const g=ctx.createLinearGradient(0,interfaceY-15,0,interfaceY+15);\n    g.addColorStop(0,'rgba(252,136,79,0)');\n    g.addColorStop(0.5,'rgba(252,136,79,0.15)');\n    g.addColorStop(1,'rgba(252,136,79,0)');\n    ctx.fillStyle=g;\n    ctx.fillRect(0,interfaceY-15,W,30);\n\n    // === Draw normal (vertical reference line) ===\n    ctx.strokeStyle='rgba(98,125,165,0.4)';\n    ctx.lineWidth=2;\n    ctx.setLineDash([4,4]);\n    ctx.beginPath();\n    ctx.moveTo(centerX,interfaceY-120);\n    ctx.lineTo(centerX,interfaceY+120);\n    ctx.stroke();\n    ctx.setLineDash([]);\n    ctx.fillStyle='#627da5';\n    ctx.font=Math.round(H*0.03)+'px sans-serif';\n    ctx.fillText('Normal',centerX+8,interfaceY-110);\n\n    // === SOURCE POINT ===\n    const sourceX=centerX;\n    const sourceY=interfaceY-100;\n    \n    // Incident ray (always visible)\n    const incRayEndX=centerX+80*Math.sin(theta1);\n    const incRayEndY=interfaceY;\n    arrow(sourceX,sourceY,incRayEndX,incRayEndY,'#ffd966',3);\n    ctx.fillStyle='#ffd966';\n    ctx.font=Math.round(H*0.03)+'px sans-serif';\n    ctx.fillText('θ₁='+incidentAngleDeg+'°',incRayEndX+12,sourceY-10);\n\n    // === WRONG PATH (bends away) ===\n    if(!showCorrect && rayProgress<1){\n      const wrongAngle=theta1+theta1*0.5; // WRONG: bends away\n      const wrongRayX=centerX+100*Math.sin(wrongAngle);\n      const wrongRayY=interfaceY+100*Math.cos(wrongAngle);\n      \n      const p1={x:centerX+(rayProgress*100)*Math.sin(wrongAngle),y:interfaceY+(rayProgress*100)*Math.cos(wrongAngle)};\n      trailWrong.push({...p1});\n      if(trailWrong.length>40)trailWrong.shift();\n      \n      trail(trailWrong,'#df8279');\n      \n      glowDot(p1.x,p1.y,8,'rgba(223,130,121,ALPHA)',0.6);\n      \n      // Draw full wrong ray\n      ctx.strokeStyle='rgba(223,130,121,0.5)';\n      ctx.lineWidth=2;\n      ctx.setLineDash([4,2]);\n      ctx.beginPath();\n      ctx.moveTo(centerX,interfaceY);\n      ctx.lineTo(wrongRayX,wrongRayY);\n      ctx.stroke();\n      ctx.setLineDash([]);\n      \n      // Wrong angle label\n      ctx.fillStyle='#df8279';\n      ctx.font=Math.round(H*0.03)+'px sans-serif';\n      ctx.fillText('✗ Wrong: θ>θ₁',wrongRayX+12,interfaceY+30);\n    }\n\n    // === CORRECT PATH (bends toward normal) ===\n    if(showCorrect){\n      if(rayProgress<1){\n        const correctRayX=centerX+100*Math.sin(theta2);\n        const correctRayY=interfaceY+100*Math.cos(theta2);\n        \n        const p2={x:centerX+(rayProgress*100","remediationGoal":"Close formula_misuse for physics."},"rendererStyle":"three_js"}}},"metadata":{"rendered_at":"2026-05-20T11:08:32.250Z","cache_hit":false,"cost_usd":0},"error":null}