index.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909
  1. <!doctype html>
  2. <html lang="ru">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta name="theme-color" content="#07110f">
  7. <title>Ночное видение и тепловидение — научная интерактивная модель</title>
  8. <style>
  9. :root {
  10. --bg: #07110f;
  11. --bg2: #0a1714;
  12. --panel: #0d1a17;
  13. --line: #1e3a32;
  14. --line2: #2a4b41;
  15. --text: #e7f3ee;
  16. --muted: #8fb3a7;
  17. --accent: #6fe3c1;
  18. --accent2: #ffb86b;
  19. --danger: #ff7d7d;
  20. --nv: #7dffb2;
  21. --shadow: rgba(0, 0, 0, 0.35);
  22. }
  23. * {
  24. box-sizing: border-box;
  25. }
  26. html, body {
  27. margin: 0;
  28. min-height: 100%;
  29. background:
  30. radial-gradient(1200px 700px at 15% -10%, rgba(111, 227, 193, 0.13), transparent 60%),
  31. radial-gradient(900px 600px at 95% 0%, rgba(255, 184, 107, 0.10), transparent 55%),
  32. linear-gradient(180deg, var(--bg), var(--bg2));
  33. color: var(--text);
  34. font-family: "Segoe UI", "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  35. }
  36. body {
  37. padding: 0 0 40px;
  38. }
  39. header {
  40. max-width: 1320px;
  41. margin: 0 auto;
  42. padding: 28px 20px 12px;
  43. }
  44. h1 {
  45. margin: 0 0 8px;
  46. font-size: clamp(22px, 3vw, 34px);
  47. font-weight: 650;
  48. letter-spacing: 0.02em;
  49. }
  50. .subtitle {
  51. margin: 0;
  52. max-width: 980px;
  53. color: var(--muted);
  54. line-height: 1.55;
  55. font-size: 15px;
  56. }
  57. main {
  58. max-width: 1320px;
  59. margin: 0 auto;
  60. padding: 10px 20px 0;
  61. }
  62. .stage {
  63. display: grid;
  64. grid-template-columns: 1fr 1fr;
  65. gap: 16px;
  66. margin-top: 18px;
  67. }
  68. @media (max-width: 980px) {
  69. .stage {
  70. grid-template-columns: 1fr;
  71. }
  72. }
  73. .panel {
  74. background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.012)), var(--panel);
  75. border: 1px solid var(--line);
  76. border-radius: 18px;
  77. overflow: hidden;
  78. box-shadow: 0 18px 50px var(--shadow);
  79. }
  80. .panel-head {
  81. display: flex;
  82. align-items: center;
  83. justify-content: space-between;
  84. gap: 12px;
  85. padding: 12px 14px;
  86. border-bottom: 1px solid var(--line);
  87. background: rgba(255, 255, 255, 0.018);
  88. }
  89. .panel-title {
  90. font-size: 14px;
  91. font-weight: 650;
  92. letter-spacing: 0.05em;
  93. text-transform: uppercase;
  94. color: var(--text);
  95. }
  96. .panel-title .dot {
  97. display: inline-block;
  98. width: 8px;
  99. height: 8px;
  100. border-radius: 50%;
  101. margin-right: 8px;
  102. background: var(--nv);
  103. box-shadow: 0 0 14px var(--nv);
  104. vertical-align: 1px;
  105. }
  106. .thermal .panel-title .dot {
  107. background: var(--accent2);
  108. box-shadow: 0 0 14px var(--accent2);
  109. }
  110. .readout {
  111. font-family: "Cascadia Code", "Consolas", monospace;
  112. font-size: 12px;
  113. color: var(--muted);
  114. white-space: nowrap;
  115. overflow: hidden;
  116. text-overflow: ellipsis;
  117. }
  118. canvas {
  119. display: block;
  120. width: 100%;
  121. aspect-ratio: 16 / 9;
  122. background: #000;
  123. }
  124. .panel-foot {
  125. padding: 10px 14px 12px;
  126. border-top: 1px solid var(--line);
  127. color: var(--muted);
  128. font-size: 12px;
  129. line-height: 1.45;
  130. min-height: 38px;
  131. }
  132. .controls {
  133. margin-top: 16px;
  134. display: grid;
  135. grid-template-columns: repeat(3, minmax(0, 1fr));
  136. gap: 14px;
  137. }
  138. @media (max-width: 980px) {
  139. .controls {
  140. grid-template-columns: 1fr;
  141. }
  142. }
  143. fieldset {
  144. margin: 0;
  145. padding: 14px;
  146. border: 1px solid var(--line);
  147. border-radius: 16px;
  148. background: rgba(255, 255, 255, 0.02);
  149. }
  150. legend {
  151. padding: 0 8px;
  152. color: var(--text);
  153. font-weight: 650;
  154. font-size: 13px;
  155. letter-spacing: 0.04em;
  156. text-transform: uppercase;
  157. }
  158. .scene-switch {
  159. display: flex;
  160. gap: 8px;
  161. flex-wrap: wrap;
  162. margin-bottom: 12px;
  163. }
  164. button {
  165. appearance: none;
  166. border: 1px solid var(--line2);
  167. background: rgba(255, 255, 255, 0.035);
  168. color: var(--text);
  169. border-radius: 12px;
  170. padding: 9px 13px;
  171. font: inherit;
  172. font-size: 13px;
  173. cursor: pointer;
  174. transition: 0.18s ease;
  175. }
  176. button:hover {
  177. border-color: var(--accent);
  178. background: rgba(111, 227, 193, 0.08);
  179. }
  180. button.active {
  181. border-color: var(--accent);
  182. background: rgba(111, 227, 193, 0.16);
  183. color: #dffff5;
  184. box-shadow: 0 0 0 1px rgba(111, 227, 193, 0.14) inset;
  185. }
  186. label {
  187. display: grid;
  188. grid-template-columns: 1fr auto;
  189. align-items: center;
  190. gap: 6px 12px;
  191. margin: 11px 0;
  192. color: var(--muted);
  193. font-size: 13px;
  194. }
  195. label > span {
  196. grid-column: 1 / -1;
  197. }
  198. input[type="range"] {
  199. width: 100%;
  200. accent-color: var(--accent);
  201. }
  202. output {
  203. font-family: "Cascadia Code", "Consolas", monospace;
  204. font-size: 12px;
  205. color: var(--text);
  206. min-width: 72px;
  207. text-align: right;
  208. }
  209. select {
  210. width: 100%;
  211. background: #0a1512;
  212. color: var(--text);
  213. border: 1px solid var(--line2);
  214. border-radius: 10px;
  215. padding: 9px 10px;
  216. font: inherit;
  217. font-size: 13px;
  218. outline: none;
  219. }
  220. select:focus,
  221. input:focus {
  222. outline: 1px solid var(--accent);
  223. outline-offset: 2px;
  224. }
  225. .check {
  226. display: flex;
  227. align-items: center;
  228. gap: 10px;
  229. grid-template-columns: auto 1fr;
  230. }
  231. .check input {
  232. width: 16px;
  233. height: 16px;
  234. accent-color: var(--accent);
  235. }
  236. .quiz {
  237. margin-top: 16px;
  238. border: 1px solid var(--line);
  239. border-radius: 18px;
  240. background: rgba(255, 255, 255, 0.02);
  241. padding: 16px;
  242. }
  243. .quiz h2 {
  244. margin: 0 0 10px;
  245. font-size: 17px;
  246. }
  247. .question {
  248. margin: 14px 0;
  249. padding: 12px;
  250. border: 1px solid var(--line);
  251. border-radius: 14px;
  252. background: rgba(0, 0, 0, 0.12);
  253. }
  254. .question p {
  255. margin: 0 0 10px;
  256. line-height: 1.45;
  257. }
  258. .question label {
  259. display: flex;
  260. align-items: flex-start;
  261. gap: 9px;
  262. margin: 7px 0;
  263. color: var(--text);
  264. font-size: 13px;
  265. line-height: 1.4;
  266. cursor: pointer;
  267. }
  268. .question input[type="radio"] {
  269. width: 15px;
  270. height: 15px;
  271. margin-top: 2px;
  272. accent-color: var(--accent);
  273. }
  274. .quiz-actions {
  275. display: flex;
  276. gap: 10px;
  277. align-items: center;
  278. flex-wrap: wrap;
  279. margin-top: 12px;
  280. }
  281. .quiz-result {
  282. margin-top: 12px;
  283. color: var(--muted);
  284. font-size: 14px;
  285. line-height: 1.5;
  286. }
  287. .quiz-result strong {
  288. color: var(--accent);
  289. }
  290. .notes {
  291. margin-top: 16px;
  292. border: 1px solid var(--line);
  293. border-radius: 18px;
  294. background: rgba(255, 255, 255, 0.018);
  295. padding: 16px;
  296. color: var(--muted);
  297. font-size: 13px;
  298. line-height: 1.6;
  299. }
  300. .notes h2 {
  301. margin: 0 0 8px;
  302. color: var(--text);
  303. font-size: 16px;
  304. }
  305. .notes code {
  306. color: var(--accent);
  307. font-family: "Cascadia Code", "Consolas", monospace;
  308. }
  309. .notes a {
  310. color: var(--accent);
  311. text-decoration: none;
  312. border-bottom: 1px dotted rgba(111, 227, 193, 0.45);
  313. }
  314. .notes a:hover {
  315. border-bottom-style: solid;
  316. }
  317. .hint {
  318. color: var(--muted);
  319. font-size: 12px;
  320. line-height: 1.45;
  321. margin: 8px 0 0;
  322. }
  323. </style>
  324. </head>
  325. <body>
  326. <header>
  327. <h1>Приборы ночного видения и тепловизоры</h1>
  328. <p class="subtitle">
  329. Слева — модель ЭОП: усиление отражённого видимого и ближнего ИК-излучения.
  330. Справа — модель тепловизора: регистрация собственного длинноволнового ИК-излучения
  331. объектов в диапазоне 8–14 мкм. Переключайте сцены, усиление, ИК-подсветку,
  332. палитру и температурный диапазон.
  333. </p>
  334. </header>
  335. <main>
  336. <section class="stage" aria-label="Сравнение ночного видения и тепловизора">
  337. <article class="panel nv">
  338. <div class="panel-head">
  339. <div class="panel-title"><span class="dot"></span>ЭОП / ночное видение</div>
  340. <div class="readout" id="nvReadout">—</div>
  341. </div>
  342. <canvas id="nvCanvas" width="720" height="405" aria-label="Изображение в приборе ночного видения"></canvas>
  343. <div class="panel-foot" id="nvFoot">
  344. Усиливается свет, отражённый объектами. В полной темноте без ИК-подсветки фотонов недостаточно.
  345. </div>
  346. </article>
  347. <article class="panel thermal">
  348. <div class="panel-head">
  349. <div class="panel-title"><span class="dot"></span>Тепловизор 8–14 мкм</div>
  350. <div class="readout" id="thermalReadout">—</div>
  351. </div>
  352. <canvas id="thermalCanvas" width="720" height="405" aria-label="Изображение в тепловизоре"></canvas>
  353. <div class="panel-foot" id="thermalFoot">
  354. Яркость/цвет зависят от радиационной температуры, коэффициента излучения ε и выбранного диапазона.
  355. </div>
  356. </article>
  357. </section>
  358. <section class="controls" aria-label="Настройки модели">
  359. <fieldset>
  360. <legend>Сцена</legend>
  361. <div class="scene-switch" id="sceneSwitch">
  362. <button type="button" data-scene="forest" class="active">Лес</button>
  363. <button type="button" data-scene="city">Город</button>
  364. <button type="button" data-scene="lab">Лаборатория</button>
  365. </div>
  366. <p class="hint" id="sceneHint">
  367. Ночной лес: слабая освещённость, тёплые биологические объекты и источник с высокой температурой.
  368. </p>
  369. </fieldset>
  370. <fieldset>
  371. <legend>ЭОП</legend>
  372. <label>
  373. <span>Усиление</span>
  374. <input id="gain" type="range" min="0.2" max="3" step="0.05" value="1.4">
  375. <output id="gainOut">1.40×</output>
  376. </label>
  377. <label>
  378. <span>Освещённость, лк</span>
  379. <input id="lux" type="range" min="0.0001" max="0.05" step="0.0001" value="0.002">
  380. <output id="luxOut">0.0020 лк</output>
  381. </label>
  382. <label class="check">
  383. <input id="ir" type="checkbox">
  384. <span>ИК-подсветка 850 нм</span>
  385. </label>
  386. <p class="hint">
  387. ЭОП не «видит тепло»: он усиливает фотоны видимого и ближнего ИК-диапазона.
  388. </p>
  389. </fieldset>
  390. <fieldset>
  391. <legend>Тепловизор</legend>
  392. <label>
  393. <span>Палитра</span>
  394. <select id="palette">
  395. <option value="whiteHot">White-hot</option>
  396. <option value="blackHot">Black-hot</option>
  397. <option value="ironbow">Ironbow</option>
  398. <option value="rainbow">Rainbow</option>
  399. <option value="lava">Lava</option>
  400. </select>
  401. </label>
  402. <label>
  403. <span>Диапазон отображения, K</span>
  404. <input id="span" type="range" min="5" max="120" step="1" value="40">
  405. <output id="spanOut">40 K</output>
  406. </label>
  407. <label>
  408. <span>Температура фона, K</span>
  409. <input id="ambient" type="range" min="250" max="310" step="1" value="283">
  410. <output id="ambientOut">283 K</output>
  411. </label>
  412. <p class="hint">
  413. При малом диапазоне слабые перепады температур становятся заметнее, но изображение чаще насыщается.
  414. </p>
  415. </fieldset>
  416. </section>
  417. <section class="quiz" id="quiz">
  418. <h2>Проверка знаний</h2>
  419. <div class="question">
  420. <p>1. Что регистрирует тепловизор в диапазоне 8–14 мкм?</p>
  421. <label><input type="radio" name="q1" value="a"> Отражённый видимый свет</label>
  422. <label><input type="radio" name="q1" value="b"> Собственное тепловое ИК-излучение объектов</label>
  423. <label><input type="radio" name="q1" value="c"> Ультрафиолетовое излучение</label>
  424. <label><input type="radio" name="q1" value="d"> Радиоволны</label>
  425. </div>
  426. <div class="question">
  427. <p>2. Почему ЭОП не даёт изображения в абсолютной темноте без ИК-подсветки?</p>
  428. <label><input type="radio" name="q2" value="a"> В поле зрения нет фотонов для усиления</label>
  429. <label><input type="radio" name="q2" value="b"> Объекты слишком холодные</label>
  430. <label><input type="radio" name="q2" value="c"> ЭОП регистрирует только ультрафиолет</label>
  431. <label><input type="radio" name="q2" value="d"> ЭОП не имеет объектива</label>
  432. </div>
  433. <div class="question">
  434. <p>3. Что произойдёт, если коэффициент излучения ε цели близок к 0, а фон имеет другую температуру?</p>
  435. <label><input type="radio" name="q3" value="a"> Цель станет ярче на любом фоне</label>
  436. <label><input type="radio" name="q3" value="b"> Цель будет сильнее маскироваться фоном за счёт отражения</label>
  437. <label><input type="radio" name="q3" value="c"> Тепловизор перестанет работать</label>
  438. <label><input type="radio" name="q3" value="d"> Появится только зелёный цвет</label>
  439. </div>
  440. <div class="quiz-actions">
  441. <button type="button" id="checkQuiz">Проверить</button>
  442. <button type="button" id="resetQuiz">Сбросить</button>
  443. </div>
  444. <div class="quiz-result" id="quizResult">Выберите ответы и нажмите «Проверить».</div>
  445. </section>
  446. <section class="notes">
  447. <h2>Научная основа модели</h2>
  448. <p>
  449. Тепловизор принимает собственное инфракрасное излучение объектов в длинноволновом диапазоне
  450. <code>8–14 мкм</code>. Для серого тела радиационная температура оценивается через закон
  451. Стефана–Больцмана и коэффициент излучения <code>ε</code>:
  452. <code>T_app = (ε·T_obj⁴ + (1−ε)·T_amb⁴)^(1/4)</code>.
  453. Поэтому блестящие металлы с малым <code>ε</code> могут быть плохо видны тепловизором.
  454. </p>
  455. <p>
  456. Прибор ночного видения с ЭОП усиливает фотоны видимого и ближнего ИК-диапазона.
  457. Ему нужен хотя бы слабый свет звёзд, Луны или ИК-подсветка. Тепловое излучение
  458. человеческого тела в диапазоне 8–14 мкм ЭОП напрямую не регистрирует.
  459. </p>
  460. <p>
  461. Ссылки: <a href="https://ru.wikipedia.org/wiki/Закон_Планка" target="_blank" rel="noreferrer">закон Планка</a>,
  462. <a href="https://ru.wikipedia.org/wiki/Тепловизор" target="_blank" rel="noreferrer">тепловизор</a>,
  463. <a href="https://ru.wikipedia.org/wiki/Прибор_ночного_видения" target="_blank" rel="noreferrer">прибор ночного видения</a>,
  464. <a href="https://ru.wikipedia.org/wiki/Стефана_—_Больцмана_закон" target="_blank" rel="noreferrer">закон Стефана–Больцмана</a>.
  465. </p>
  466. </section>
  467. </main>
  468. <script>
  469. "use strict";
  470. const NV_W = 720;
  471. const NV_H = 405;
  472. const nvCanvas = document.getElementById("nvCanvas");
  473. const thermalCanvas = document.getElementById("thermalCanvas");
  474. const nvCtx = nvCanvas.getContext("2d");
  475. const thermalCtx = thermalCanvas.getContext("2d");
  476. const gainInput = document.getElementById("gain");
  477. const gainOut = document.getElementById("gainOut");
  478. const luxInput = document.getElementById("lux");
  479. const luxOut = document.getElementById("luxOut");
  480. const irInput = document.getElementById("ir");
  481. const paletteInput = document.getElementById("palette");
  482. const spanInput = document.getElementById("span");
  483. const spanOut = document.getElementById("spanOut");
  484. const ambientInput = document.getElementById("ambient");
  485. const ambientOut = document.getElementById("ambientOut");
  486. const nvReadout = document.getElementById("nvReadout");
  487. const thermalReadout = document.getElementById("thermalReadout");
  488. const nvFoot = document.getElementById("nvFoot");
  489. const thermalFoot = document.getElementById("thermalFoot");
  490. const sceneHint = document.getElementById("sceneHint");
  491. const sceneSwitch = document.getElementById("sceneSwitch");
  492. const scenes = {
  493. forest: {
  494. title: "Ночной лес",
  495. hint: "Ночной лес: слабая освещённость, тёплые биологические объекты и источник с высокой температурой.",
  496. elements: [
  497. { type: "rect", x: 0, y: 0, w: 1, h: 0.42, temp: 255, em: 0.95, refl: 0.01, bg: true },
  498. { type: "rect", x: 0, y: 0.42, w: 1, h: 0.58, temp: 284, em: 0.96, refl: 0.12 },
  499. { type: "rect", x: 0.10, y: 0.24, w: 0.055, h: 0.76, temp: 279, em: 0.90, refl: 0.18 },
  500. { type: "ellipse", x: 0.035, y: 0.10, w: 0.20, h: 0.24, temp: 285, em: 0.94, refl: 0.08 },
  501. { type: "rect", x: 0.27, y: 0.30, w: 0.045, h: 0.70, temp: 279, em: 0.90, refl: 0.18 },
  502. { type: "ellipse", x: 0.21, y: 0.16, w: 0.17, h: 0.22, temp: 285, em: 0.94, refl: 0.08 },
  503. { type: "rect", x: 0.84, y: 0.22, w: 0.06, h: 0.78, temp: 279, em: 0.90, refl: 0.18 },
  504. { type: "ellipse", x: 0.77, y: 0.09, w: 0.20, h: 0.24, temp: 285, em: 0.94, refl: 0.08 },
  505. { type: "ellipse", x: 0.66, y: 0.54, w: 0.065, h: 0.065, temp: 310, em: 0.98, refl: 0.35 },
  506. { type: "rect", x: 0.665, y: 0.595, w: 0.055, h: 0.24, temp: 309, em: 0.98, refl: 0.34 },
  507. { type: "ellipse", x: 0.75, y: 0.64, w: 0.10, h: 0.11, temp: 305, em: 0.97, refl: 0.30 },
  508. { type: "ellipse", x: 0.43, y: 0.70, w: 0.06, h: 0.08, temp: 900, em: 0.90, refl: 0.05 },
  509. { type: "ellipse", x: 0.48, y: 0.74, w: 0.04, h: 0.05, temp: 780, em: 0.88, refl: 0.05 }
  510. ]
  511. },
  512. city: {
  513. title: "Город ночью",
  514. hint: "Город ночью: холодное небо, нагретые здания и дороги, горячий двигатель автомобиля и человек.",
  515. elements: [
  516. { type: "rect", x: 0, y: 0, w: 1, h: 0.38, temp: 258, em: 0.95, refl: 0.01, bg: true },
  517. { type: "rect", x: 0, y: 0.38, w: 1, h: 0.62, temp: 290, em: 0.96, refl: 0.10 },
  518. { type: "rect", x: 0.04, y: 0.16, w: 0.20, h: 0.52, temp: 285, em: 0.92, refl: 0.20 },
  519. { type: "rect", x: 0.29, y: 0.08, w: 0.18, h: 0.62, temp: 286, em: 0.92, refl: 0.20 },
  520. { type: "rect", x: 0.52, y: 0.20, w: 0.15, h: 0.48, temp: 284, em: 0.92, refl: 0.20 },
  521. { type: "rect", x: 0.73, y: 0.12, w: 0.23, h: 0.56, temp: 287, em: 0.92, refl: 0.20 },
  522. { type: "rect", x: 0.075, y: 0.25, w: 0.045, h: 0.06, temp: 295, em: 0.90, refl: 0.25 },
  523. { type: "rect", x: 0.155, y: 0.25, w: 0.045, h: 0.06, temp: 295, em: 0.90, refl: 0.25 },
  524. { type: "rect", x: 0.075, y: 0.39, w: 0.045, h: 0.06, temp: 295, em: 0.90, refl: 0.25 },
  525. { type: "rect", x: 0.155, y: 0.39, w: 0.045, h: 0.06, temp: 295, em: 0.90, refl: 0.25 },
  526. { type: "rect", x: 0.31, y: 0.23, w: 0.045, h: 0.06, temp: 296, em: 0.90, refl: 0.25 },
  527. { type: "rect", x: 0.39, y: 0.23, w: 0.045, h: 0.06, temp: 296, em: 0.90, refl: 0.25 },
  528. { type: "rect", x: 0.31, y: 0.41, w: 0.045, h: 0.06, temp: 296, em: 0.90, refl: 0.25 },
  529. { type: "rect", x: 0.39, y: 0.41, w: 0.045, h: 0.06, temp: 296, em: 0.90, refl: 0.25 },
  530. { type: "rect", x: 0.15, y: 0.78, w: 0.30, h: 0.09, temp: 300, em: 0.86, refl: 0.22 },
  531. { type: "rect", x: 0.19, y: 0.72, w: 0.18, h: 0.08, temp: 305, em: 0.88, refl: 0.24 },
  532. { type: "ellipse", x: 0.20, y: 0.70, w: 0.05, h: 0.04, temp: 360, em: 0.80, refl: 0.15 },
  533. { type: "ellipse", x: 0.79, y: 0.55, w: 0.06, h: 0.06, temp: 310, em: 0.98, refl: 0.35 },
  534. { type: "rect", x: 0.795, y: 0.59, w: 0.05, h: 0.24, temp: 309, em: 0.98, refl: 0.34 }
  535. ]
  536. },
  537. lab: {
  538. title: "Лаборатория",
  539. hint: "Лаборатория: ровный фон, горячая чашка, холодный лёд, электроника и человек.",
  540. elements: [
  541. { type: "rect", x: 0, y: 0, w: 1, h: 0.55, temp: 293, em: 0.94, refl: 0.35, bg: true },
  542. { type: "rect", x: 0, y: 0.55, w: 1, h: 0.45, temp: 295, em: 0.92, refl: 0.30 },
  543. { type: "rect", x: 0.08, y: 0.62, w: 0.84, h: 0.06, temp: 295, em: 0.90, refl: 0.30 },
  544. { type: "ellipse", x: 0.16, y: 0.51, w: 0.08, h: 0.10, temp: 350, em: 0.85, refl: 0.20 },
  545. { type: "rect", x: 0.17, y: 0.56, w: 0.06, h: 0.07, temp: 345, em: 0.84, refl: 0.20 },
  546. { type: "ellipse", x: 0.32, y: 0.57, w: 0.08, h: 0.05, temp: 273, em: 0.96, refl: 0.45 },
  547. { type: "rect", x: 0.55, y: 0.43, w: 0.18, h: 0.13, temp: 330, em: 0.86, refl: 0.18 },
  548. { type: "rect", x: 0.57, y: 0.45, w: 0.14, h: 0.09, temp: 335, em: 0.86, refl: 0.18 },
  549. { type: "ellipse", x: 0.78, y: 0.48, w: 0.06, h: 0.06, temp: 310, em: 0.98, refl: 0.35 },
  550. { type: "rect", x: 0.79, y: 0.53, w: 0.05, h: 0.22, temp: 309, em: 0.98, refl: 0.34 },
  551. { type: "rect", x: 0.90, y: 0.60, w: 0.06, h: 0.08, temp: 320, em: 0.88, refl: 0.20 }
  552. ]
  553. }
  554. };
  555. let activeScene = "forest";
  556. let rafId = null;
  557. function clamp(v, min, max) {
  558. return Math.max(min, Math.min(max, v));
  559. }
  560. function drawShape(ctx, el, color) {
  561. const x = el.x * NV_W;
  562. const y = el.y * NV_H;
  563. const w = el.w * NV_W;
  564. const h = el.h * NV_H;
  565. ctx.fillStyle = color;
  566. if (el.type === "rect") {
  567. ctx.fillRect(x, y, w, h);
  568. } else if (el.type === "ellipse") {
  569. ctx.beginPath();
  570. ctx.ellipse(x + w / 2, y + h / 2, Math.max(0.1, w / 2), Math.max(0.1, h / 2), 0, 0, Math.PI * 2);
  571. ctx.fill();
  572. }
  573. }
  574. function nvBrightness(el) {
  575. const gain = parseFloat(gainInput.value);
  576. const lux = parseFloat(luxInput.value);
  577. const irOn = irInput.checked ? 1 : 0;
  578. const photonFactor = lux * 200 + irOn * 2.0;
  579. let v = 0.045 + photonFactor * el.refl * gain;
  580. v = Math.pow(clamp(v, 0, 1), 0.72);
  581. return Math.round(v * 255);
  582. }
  583. function drawNV() {
  584. const scene = scenes[activeScene];
  585. nvCtx.fillStyle = "#010806";
  586. nvCtx.fillRect(0, 0, NV_W, NV_H);
  587. for (const el of scene.elements) {
  588. const g = nvBrightness(el);
  589. const r = Math.round(g * 0.22);
  590. const gg = Math.round(g);
  591. const b = Math.round(g * 0.42);
  592. drawShape(nvCtx, el, `rgb(${r},${gg},${b})`);
  593. }
  594. nvCtx.save();
  595. nvCtx.globalCompositeOperation = "lighter";
  596. for (let i = 0; i < 2600; i++) {
  597. const x = Math.random() * NV_W;
  598. const y = Math.random() * NV_H;
  599. const a = Math.random() * 0.06;
  600. nvCtx.fillStyle = `rgba(120,255,180,${a})`;
  601. nvCtx.fillRect(x, y, 1, 1);
  602. }
  603. nvCtx.restore();
  604. nvCtx.save();
  605. nvCtx.globalAlpha = 0.08;
  606. nvCtx.strokeStyle = "#7dffb2";
  607. nvCtx.lineWidth = 1;
  608. for (let y = 0; y < NV_H; y += 4) {
  609. nvCtx.beginPath();
  610. nvCtx.moveTo(0, y + 0.5);
  611. nvCtx.lineTo(NV_W, y + 0.5);
  612. nvCtx.stroke();
  613. }
  614. nvCtx.restore();
  615. const gain = parseFloat(gainInput.value);
  616. const lux = parseFloat(luxInput.value);
  617. nvReadout.textContent = `E=${lux.toExponential(2)} лк · G=${gain.toFixed(2)}× · ИК=${irInput.checked ? "вкл" : "выкл"}`;
  618. nvFoot.textContent = irInput.checked
  619. ? "ИК-подсветка 850 нм добавляет фотоны ближнего ИК-диапазона; сильнее проявляются объекты с высоким отражением."
  620. : "Без ИК-подсветки яркость зависит от внешней освещённости и отражения объектов; в полной темноте сигнала нет.";
  621. }
  622. function lerpStops(stops, t) {
  623. t = clamp(t, 0, 1);
  624. const n = stops.length - 1;
  625. const p = t * n;
  626. const i = Math.floor(p);
  627. const f = p - i;
  628. const a = stops[i];
  629. const b = stops[Math.min(n, i + 1)];
  630. return [
  631. Math.round(a[0] + (b[0] - a[0]) * f),
  632. Math.round(a[1] + (b[1] - a[1]) * f),
  633. Math.round(a[2] + (b[2] - a[2]) * f)
  634. ];
  635. }
  636. function paletteColor(name, t) {
  637. t = clamp(t, 0, 1);
  638. if (name === "whiteHot") {
  639. const v = Math.round(255 * t);
  640. return `rgb(${v},${v},${v})`;
  641. }
  642. if (name === "blackHot") {
  643. const v = Math.round(255 * (1 - t));
  644. return `rgb(${v},${v},${v})`;
  645. }
  646. let stops;
  647. if (name === "ironbow") {
  648. stops = [
  649. [0, 0, 0],
  650. [40, 0, 70],
  651. [140, 30, 20],
  652. [230, 120, 0],
  653. [255, 210, 40],
  654. [255, 255, 255]
  655. ];
  656. } else if (name === "rainbow") {
  657. stops = [
  658. [0, 0, 70],
  659. [0, 160, 255],
  660. [0, 220, 120],
  661. [255, 230, 0],
  662. [255, 80, 0],
  663. [255, 255, 255]
  664. ];
  665. } else {
  666. stops = [
  667. [20, 0, 30],
  668. [120, 0, 90],
  669. [220, 40, 20],
  670. [255, 160, 0],
  671. [255, 255, 180]
  672. ];
  673. }
  674. const [r, g, b] = lerpStops(stops, t);
  675. return `rgb(${r},${g},${b})`;
  676. }
  677. function apparentTemperature(el, ambient) {
  678. const eps = clamp(el.em, 0.01, 1);
  679. const t4 = eps * Math.pow(el.temp, 4) + (1 - eps) * Math.pow(ambient, 4);
  680. return Math.pow(t4, 0.25);
  681. }
  682. function drawThermal() {
  683. const scene = scenes[activeScene];
  684. const ambient = parseFloat(ambientInput.value);
  685. const span = parseFloat(spanInput.value);
  686. const paletteName = paletteInput.value;
  687. thermalCtx.fillStyle = "#000";
  688. thermalCtx.fillRect(0, 0, NV_W, NV_H);
  689. const center = ambient + 10;
  690. const minT = center - span / 2;
  691. const maxT = center + span / 2;
  692. for (const el of scene.elements) {
  693. const baseTemp = el.bg ? ambient : el.temp;
  694. const tempForCalc = el.bg ? { ...el, temp: baseTemp } : el;
  695. const tApp = apparentTemperature(tempForCalc, ambient);
  696. const t = (tApp - minT) / Math.max(0.001, maxT - minT);
  697. const color = paletteColor(paletteName, t);
  698. drawShape(thermalCtx, el, color);
  699. }
  700. thermalCtx.save();
  701. for (let i = 0; i < 3600; i++) {
  702. const x = Math.random() * NV_W;
  703. const y = Math.random() * NV_H;
  704. const a = Math.random() * 0.045;
  705. thermalCtx.fillStyle = `rgba(255,255,255,${a})`;
  706. thermalCtx.fillRect(x, y, 1, 1);
  707. }
  708. thermalCtx.restore();
  709. thermalReadout.textContent = `T_фона=${ambient} K · ΔT=${span} K · ${paletteName}`;
  710. thermalFoot.textContent = `Окно отображения: ${Math.round(minT)}–${Math.round(maxT)} K. Цвет зависит от ε, температуры объекта и фона.`;
  711. }
  712. function render() {
  713. drawNV();
  714. drawThermal();
  715. }
  716. function scheduleRender() {
  717. if (rafId !== null) {
  718. cancelAnimationFrame(rafId);
  719. }
  720. rafId = requestAnimationFrame(() => {
  721. rafId = null;
  722. render();
  723. });
  724. }
  725. function updateOutputs() {
  726. gainOut.textContent = `${parseFloat(gainInput.value).toFixed(2)}×`;
  727. luxOut.textContent = `${parseFloat(luxInput.value).toFixed(4)} лк`;
  728. spanOut.textContent = `${spanInput.value} K`;
  729. ambientOut.textContent = `${ambientInput.value} K`;
  730. }
  731. function onControlsChange() {
  732. updateOutputs();
  733. scheduleRender();
  734. }
  735. gainInput.addEventListener("input", onControlsChange);
  736. luxInput.addEventListener("input", onControlsChange);
  737. irInput.addEventListener("change", onControlsChange);
  738. paletteInput.addEventListener("change", onControlsChange);
  739. spanInput.addEventListener("input", onControlsChange);
  740. ambientInput.addEventListener("input", onControlsChange);
  741. sceneSwitch.addEventListener("click", (event) => {
  742. const btn = event.target.closest("button[data-scene]");
  743. if (!btn) return;
  744. activeScene = btn.dataset.scene;
  745. for (const b of sceneSwitch.querySelectorAll("button")) {
  746. b.classList.toggle("active", b === btn);
  747. }
  748. const scene = scenes[activeScene];
  749. sceneHint.textContent = scene.hint;
  750. scheduleRender();
  751. });
  752. const answers = {
  753. q1: "b",
  754. q2: "a",
  755. q3: "b"
  756. };
  757. document.getElementById("checkQuiz").addEventListener("click", () => {
  758. let correct = 0;
  759. let answered = 0;
  760. for (const key of Object.keys(answers)) {
  761. const selected = document.querySelector(`input[name="${key}"]:checked`);
  762. if (selected) {
  763. answered++;
  764. if (selected.value === answers[key]) {
  765. correct++;
  766. }
  767. }
  768. }
  769. const result = document.getElementById("quizResult");
  770. if (answered < 3) {
  771. result.innerHTML = `Ответьте на все вопросы. Сейчас выбрано <strong>${answered}</strong> из 3.`;
  772. return;
  773. }
  774. if (correct === 3) {
  775. result.innerHTML = "Верно: <strong>3/3</strong>. Вы корректно различаете принципы ЭОП и тепловизора.";
  776. } else if (correct === 2) {
  777. result.innerHTML = "Результат: <strong>2/3</strong>. Один принцип стоит повторить: различие отражённого и собственного ИК-излучения.";
  778. } else if (correct === 1) {
  779. result.innerHTML = "Результат: <strong>1/3</strong>. Вернитесь к блоку «Научная основа модели» и сравните ЭОП с тепловизором.";
  780. } else {
  781. result.innerHTML = "Результат: <strong>0/3</strong>. Начните с ключевой идеи: ЭОП усиливает свет, тепловизор регистрирует тепловое ИК-излучение.";
  782. }
  783. });
  784. document.getElementById("resetQuiz").addEventListener("click", () => {
  785. for (const radio of document.querySelectorAll('#quiz input[type="radio"]')) {
  786. radio.checked = false;
  787. }
  788. document.getElementById("quizResult").textContent = "Выберите ответы и нажмите «Проверить».";
  789. });
  790. updateOutputs();
  791. render();
  792. setInterval(() => {
  793. render();
  794. }, 140);
  795. </script>
  796. </body>
  797. </html>