{"job_id":"anim-job-7bd05f62-2dba-406b-9850-c044f316e870","request_id":"test-physics-snell-ba30c5e5-e5bb-4ff3-90a7-a40b2e480a51-1778708287067","status":"complete","asset":{"primary_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-7bd05f62-2dba-406b-9850-c044f316e870/walkthrough.mp4","thumbnail_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-7bd05f62-2dba-406b-9850-c044f316e870/thumb.jpg","transcript_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-7bd05f62-2dba-406b-9850-c044f316e870/transcript.vtt","interactive_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-7bd05f62-2dba-406b-9850-c044f316e870/index.html","scenefile_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-7bd05f62-2dba-406b-9850-c044f316e870/scene-source.json","duration_seconds":15,"byte_size":470346,"renderer":"html_three_js_local","parameters":{"style":"auto","executor":"native_render_executor","localPath":"/app/storage/assets/anim-job-7bd05f62-2dba-406b-9850-c044f316e870","interactivity":"none","renderer_style":"three_js","durationSeconds":15,"render_manifest":{"jobId":"anim-job-7bd05f62-2dba-406b-9850-c044f316e870","request":{"gap":{"topic":"snell-refraction-angle","severity":"moderate","error_type":"formula_misuse","memory_state":"fragile","display_topic":"Snell's Law — Refraction at an 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":"12","language":"en"},"interactivity":"none","duration_seconds":15},"context":{"chapter":{"name":"Ray Optics","ncert_class":12,"ncert_chapter_number":9},"sub_topics":[{"topic":"Refraction","key_concepts":["Snell's law","refractive index","critical angle","total internal reflection"]}]},"metadata":{"priority":"normal"},"exam_type":"neet","asset_type":"simulation","request_id":"test-physics-snell-ba30c5e5-e5bb-4ff3-90a7-a40b2e480a51-1778708287067","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 an 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 an 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 Correction</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\",\"Inter\",ui-sans-serif,system-ui,sans-serif;background:radial-gradient(120% 90% at 20% -5%,#24343d 0%,#0f1418 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>Snell's Law</h1>\n    <p class=\"sub\">Refraction: Rare → Dense Medium</p>\n    <p class=\"formula\">n₁ sin θ₁ = n₂ sin θ₂</p>\n    <label class=\"control\"><span>Incident angle θ₁: <strong id=\"v-theta1\">35</strong>°</span><input id=\"c-theta1\" type=\"range\" min=\"15\" max=\"70\" step=\"1\" value=\"35\"/></label>\n    <label class=\"control\"><span>Refractive index n₁: <strong id=\"v-n1\">1.0</strong></span><input id=\"c-n1\" type=\"range\" min=\"1.0\" max=\"1.3\" step=\"0.05\" value=\"1.0\"/></label>\n    <label class=\"control\"><span>Refractive index n₂: <strong id=\"v-n2\">1.5</strong></span><input id=\"c-n2\" type=\"range\" min=\"1.4\" max=\"2.2\" step=\"0.05\" value=\"1.5\"/></label>\n    <ul>\n      <li><strong>❌ Misconception:</strong> Ray bends away from normal.</li>\n      <li><strong>✓ Correct:</strong> Ray bends <em>toward</em> normal (n₁ &lt; n₂).</li>\n      <li><strong>Why:</strong> Denser medium slows light → smaller angle.</li>\n      <li><strong>Formula:</strong> n₁ sin θ₁ = n₂ sin θ₂ → sin θ₂ &lt; sin θ₁.</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 = [\n  {\"key\":\"theta1\",\"label\":\"Incident angle\",\"min\":15,\"max\":70,\"step\":1,\"value\":35,\"units\":\"°\"},\n  {\"key\":\"n1\",\"label\":\"Refractive index (rare)\",\"min\":1.0,\"max\":1.3,\"step\":0.05,\"value\":1.0,\"units\":\"\"},\n  {\"key\":\"n2\",\"label\":\"Refractive index (dense)\",\"min\":1.4,\"max\":2.2,\"step\":0.05,\"value\":1.5,\"units\":\"\"}\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=c.key.includes('n')?inp.value:inp.value;\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  \n  // State variables\n  let theta1 = 35 * Math.PI / 180;\n  let n1 = 1.0;\n  let n2 = 1.5;\n  let theta2 = 0;\n  let rayT = 0;\n  let trailRare = [];\n  let trailDense = [];\n  let lastTs = 0;\n  \n  function updateRefraction() {\n    theta1 = Number(document.getElementById('c-theta1').value) * Math.PI / 180;\n    n1 = Number(document.getElementById('c-n1').value);\n    n2 = Number(document.getElementById('c-n2').value);\n    const sinTheta2 = (n1 / n2) * Math.sin(theta1);\n    theta2 = Math.asin(Math.min(1, sinTheta2));\n    rayT = 0;\n    trailRare = [];\n    trailDense = [];\n  }\n  \n  function glowDot(x, y, r, color, a) {\n    const g = ctx.createRadialGradient(x, y, 0, x, y, r * 2.6);\n    const c1 = color.replace('ALPHA', String(a));\n    const c2 = color.replace('ALPHA', '0');\n    g.addColorStop(0, c1);\n    g.addColorStop(1, c2);\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 arrow(x1, y1, x2, y2, color) {\n    const dx = x2 - x1;\n    const dy = y2 - y1;\n    const l = Math.sqrt(dx * dx + dy * dy);\n    if (l < 2) return;\n    const nx = dx / l;\n    const ny = dy / l;\n    const s = 10;\n    ctx.strokeStyle = color;\n    ctx.lineWidth = 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;\n    const H = cv.height;\n    \n    const interfaceY = H * 0.55;\n    const startX = W * 0.25;\n    const startY = H * 0.15;\n    \n    // Update ray animation (cyclic: 0→1 every 2.5 sec)\n    rayT += dt / 2.5;\n    if (rayT > 1) {\n      rayT = 0;\n      trailRare = [];\n      trailDense = [];\n    }\n    \n    // Incident ray position & trail\n    let incX, incY;\n    if (rayT < 0.5) {\n      const t = rayT * 2;\n      incX = startX + t * (interfaceY - startY) / Math.tan(theta1) * 0.8;\n      incY = startY + t * (interfaceY - startY);\n    } else {\n      incX = startX + 0.8 * (interfaceY - startY) / Math.tan(theta1);\n      incY = interfaceY;\n    }\n    \n    if (rayT < 0.5) {\n      trailRare.push({x: incX, y: incY});\n      if (trailRare.length > 30) trailRare.shift();\n    }\n    \n    // Refracted ray position & trail\n    let refX, refY;\n    if (rayT >= 0.5) {\n      const t = (rayT - 0.5) * 2;\n      const intX = startX + 0.8 * (interfaceY - startY) / Math.tan(theta1);\n      const intY = interfaceY;\n      refX = intX + t * (H * 0.35) / Math.tan(theta2) * 0.9;\n      refY = intY + t * (H * 0.35);\n      trailDense.push({x: refX, y: refY});\n      if (trailDense.length > 30) trailDense.shift();\n    } else {\n      refX = startX + 0.8 * (interfaceY - startY) / Math.tan(theta1);\n      refY = interfaceY;\n    }\n    \n    // Draw scene\n    ctx.clearRect(0, 0, W, H);\n    \n    // Background gradient layers\n    const mediumAir = ctx.createLinearGradient(0, 0, 0, interfaceY);\n    mediumAir.addColorStop(0, 'rgba(80, 100, 120, 0.15)');\n    mediumAir.addColorStop(1, 'rgba(60, 80, 100, 0.1)');\n    ctx.fillStyle = mediumAir;\n    ctx.fillRect(0, 0, W, interfaceY);\n    \n    const mediumWater = ctx.createLinearGradient(0, interfaceY, 0, H);\n    mediumWater.addColorStop(0, 'rgba(30, 120, 150, 0.2)');\n    mediumWater.addColorStop(1, 'rgba(20, 80, 120, 0.15)');\n    ctx.fillStyle = mediumWater;\n    ctx.fillRect(0, interfaceY, W, H - interfaceY);\n    \n    // Interface line\n    ctx.strokeStyle = 'rgba(229, 186, 103, 0.6)';\n    ctx.lineWidth = 3;\n    ctx.setLineDash([8, 4]);\n    ctx.beginPath();\n    ctx.moveTo(0, interfaceY);\n    ctx.lineTo(W, interfaceY);\n    ctx.stroke();\n    ctx.setLineDash([]);\n    \n    // Normal line (dashed vertical)\n    const normalX = startX + 0.8 * (interfaceY - startY) / Math.tan(theta1);\n    ctx.strokeStyle = 'rgba(200, 212, 218, 0.3)';\n    ctx.lineWidth = 1.5;\n    ctx.setLineDash([4, 2]);\n    ctx.beginPath();\n    ctx.moveTo(normalX, startY - 20);\n    ctx.lineTo(normalX, H - 20);\n    ctx.stroke();\n    ctx.setLineDash([]);\n    \n    // Trail: incident ray (fading)\n    if (trailRare.length > 1) {\n      ctx.strokeStyle = 'rgba(99, 179, 255, 0.4)';\n      ctx.lineWidth = 2;\n      ctx.beginPath();\n      ctx.moveTo(trailRare[0].x, trailRare[0].y);\n      for (let i = 1; i < trailRare.length; i++) {\n        ctx.lineTo(trailRare[i].x, trailRare[i].y);\n      }\n      ctx.stroke();\n    }\n    \n    // Trail: refracted ray (fading)\n    if (trailDense.length > 1) {\n      ctx.strokeStyle = 'rgba(135, 232, 168, 0.4)';\n      ctx.lineWidth = 2;\n      ctx.beginPath();\n      ctx.moveTo(trailDense[0].x, trailDense[0].y);\n      for (let i = 1; i < trailDense.length; i++) {\n        ctx.lineTo(trailDense[i].x, trailDense[i].y);\n      }\n      ctx.stroke();\n    }\n    \n    // Draw incident ray\n    if (rayT < 0.5) {\n      arrow(startX, startY, incX, incY, '#63b3ff');\n      glowDot(incX, incY, 5, 'rgba(99, 179, 255, ALPHA)', 0.8);\n    }\n    \n    // Draw refracted ray\n    if (rayT >= 0.5) {\n      const intX = startX + 0.8 * (interfaceY - startY) / Math.tan(theta1);\n      const intY = interfaceY;\n      arrow(intX, intY, refX, refY, '#87e8a8');\n      glowDot(refX, refY, 5, 'rgba(135, 232, 168, ALPHA)', 0.8);\n    }\n    \n    // Interaction point glow\n    const int","remediationGoal":"Close formula_misuse for physics."},"rendererStyle":"three_js"}}},"metadata":{"rendered_at":"2026-05-13T21:45:56.910Z","cache_hit":false,"cost_usd":0},"error":null}