index.html 96 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071
  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.0">
  6. <title>Электромагнитный канал утечки информации</title>
  7. <link rel="preconnect" href="https://fonts.googleapis.com">
  8. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  9. <link href="https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;700&family=PT+Serif:ital,wght@0,400;0,700;1,400&family=Roboto+Mono:wght@400;700&display=swap" rel="stylesheet">
  10. <style>
  11. :root {
  12. --paper: #f2e9d6;
  13. --paper-dark: #e6dac2;
  14. --ink: #1a2a4a;
  15. --ink-light: #4a5a7a;
  16. --red: #8b1a1a;
  17. --red-light: #b84242;
  18. --blue: #1a4a6a;
  19. --blue-light: #3a7aa0;
  20. --green: #2a5a2a;
  21. --line: #c4b8a0;
  22. }
  23. * { box-sizing: border-box; }
  24. html, body { margin: 0; padding: 0; }
  25. body {
  26. background:
  27. repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(0,0,0,0.03) 24px),
  28. var(--paper);
  29. color: var(--ink);
  30. font-family: 'PT Serif', Georgia, serif;
  31. min-height: 100vh;
  32. display: flex;
  33. justify-content: center;
  34. padding: 20px;
  35. line-height: 1.6;
  36. }
  37. .app {
  38. width: 100%;
  39. max-width: 900px;
  40. background: var(--paper);
  41. border: 2px solid var(--ink);
  42. box-shadow: 6px 6px 0 rgba(26,42,74,0.15);
  43. position: relative;
  44. }
  45. .app::before {
  46. content: '';
  47. position: absolute;
  48. inset: 8px;
  49. border: 1px solid var(--line);
  50. pointer-events: none;
  51. z-index: 1;
  52. }
  53. .header {
  54. padding: 20px 30px 15px;
  55. border-bottom: 2px solid var(--ink);
  56. position: relative;
  57. z-index: 2;
  58. }
  59. .header-top {
  60. display: flex;
  61. justify-content: space-between;
  62. align-items: baseline;
  63. font-family: 'Roboto Mono', monospace;
  64. font-size: 11px;
  65. letter-spacing: 1px;
  66. text-transform: uppercase;
  67. color: var(--ink-light);
  68. margin-bottom: 8px;
  69. }
  70. .header h1 {
  71. font-family: 'Oswald', sans-serif;
  72. font-weight: 700;
  73. font-size: 28px;
  74. letter-spacing: 1px;
  75. text-transform: uppercase;
  76. margin: 0;
  77. color: var(--ink);
  78. }
  79. .header .sub {
  80. font-family: 'PT Serif', serif;
  81. font-style: italic;
  82. font-size: 14px;
  83. color: var(--ink-light);
  84. margin-top: 4px;
  85. }
  86. .progress {
  87. display: flex;
  88. gap: 3px;
  89. padding: 12px 30px;
  90. background: var(--paper-dark);
  91. border-bottom: 1px solid var(--line);
  92. position: relative;
  93. z-index: 2;
  94. }
  95. .progress-step {
  96. flex: 1;
  97. height: 4px;
  98. background: var(--line);
  99. transition: background 0.3s;
  100. }
  101. .progress-step.done { background: var(--blue); }
  102. .progress-step.current { background: var(--red); }
  103. .content {
  104. padding: 30px;
  105. position: relative;
  106. z-index: 2;
  107. min-height: 400px;
  108. }
  109. .scene { display: none; animation: fadeIn 0.4s ease-out; }
  110. .scene.active { display: block; }
  111. @keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
  112. .scene-num {
  113. font-family: 'Roboto Mono', monospace;
  114. font-size: 11px;
  115. letter-spacing: 2px;
  116. color: var(--red);
  117. text-transform: uppercase;
  118. margin-bottom: 6px;
  119. }
  120. .scene-title {
  121. font-family: 'Oswald', sans-serif;
  122. font-size: 22px;
  123. font-weight: 500;
  124. letter-spacing: 0.5px;
  125. margin: 0 0 16px;
  126. text-transform: uppercase;
  127. }
  128. .scene p {
  129. font-size: 15px;
  130. margin: 0 0 12px;
  131. }
  132. .scene p.lead {
  133. font-size: 16px;
  134. color: var(--ink-light);
  135. font-style: italic;
  136. }
  137. .notebook {
  138. background: #fffef8;
  139. border: 1px solid var(--red);
  140. border-left: 6px solid var(--red);
  141. padding: 16px 20px;
  142. margin: 20px 0;
  143. position: relative;
  144. background-image: repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(139,26,26,0.08) 24px);
  145. }
  146. .notebook::before {
  147. content: 'ЗАПИШИ В ТЕТРАДЬ';
  148. position: absolute;
  149. top: -10px;
  150. left: 12px;
  151. background: var(--red);
  152. color: #fff;
  153. font-family: 'Roboto Mono', monospace;
  154. font-size: 10px;
  155. font-weight: 700;
  156. letter-spacing: 2px;
  157. padding: 2px 8px;
  158. }
  159. .notebook p {
  160. margin: 6px 0;
  161. font-size: 14px;
  162. line-height: 1.7;
  163. }
  164. .notebook p:first-child { margin-top: 4px; }
  165. .notebook strong { color: var(--red); }
  166. .notebook .formula {
  167. font-family: 'Roboto Mono', monospace;
  168. background: rgba(139,26,26,0.08);
  169. padding: 2px 6px;
  170. font-size: 13px;
  171. border-radius: 2px;
  172. }
  173. .viz {
  174. background: #fffef8;
  175. border: 1px solid var(--line);
  176. padding: 16px;
  177. margin: 20px 0;
  178. position: relative;
  179. }
  180. .viz canvas { display: block; width: 100%; }
  181. .viz-caption {
  182. font-family: 'Roboto Mono', monospace;
  183. font-size: 11px;
  184. color: var(--ink-light);
  185. text-align: center;
  186. margin-top: 8px;
  187. letter-spacing: 0.5px;
  188. }
  189. .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  190. @media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }
  191. .control-group { margin: 14px 0; }
  192. .control-label {
  193. display: flex;
  194. justify-content: space-between;
  195. font-family: 'Roboto Mono', monospace;
  196. font-size: 12px;
  197. text-transform: uppercase;
  198. letter-spacing: 0.5px;
  199. margin-bottom: 4px;
  200. }
  201. .control-label .val { color: var(--blue); font-weight: 700; }
  202. input[type=range] {
  203. -webkit-appearance: none;
  204. width: 100%;
  205. height: 6px;
  206. background: linear-gradient(to right, var(--line), var(--ink-light));
  207. border-radius: 3px;
  208. outline: none;
  209. margin: 6px 0;
  210. }
  211. input[type=range]::-webkit-slider-thumb {
  212. -webkit-appearance: none;
  213. width: 18px;
  214. height: 18px;
  215. background: var(--red);
  216. border: 2px solid var(--ink);
  217. border-radius: 50%;
  218. cursor: pointer;
  219. }
  220. input[type=range]::-moz-range-thumb {
  221. width: 18px;
  222. height: 18px;
  223. background: var(--red);
  224. border: 2px solid var(--ink);
  225. border-radius: 50%;
  226. cursor: pointer;
  227. }
  228. .indicator {
  229. background: var(--ink);
  230. color: #4af626;
  231. font-family: 'Roboto Mono', monospace;
  232. font-size: 24px;
  233. font-weight: 700;
  234. padding: 10px 16px;
  235. text-align: right;
  236. border-radius: 3px;
  237. letter-spacing: 1px;
  238. text-shadow: 0 0 8px rgba(74,246,38,0.6);
  239. margin: 12px 0;
  240. display: flex;
  241. justify-content: space-between;
  242. align-items: baseline;
  243. }
  244. .indicator small { font-size: 11px; color: #8aa; letter-spacing: 1px; }
  245. .feedback {
  246. background: rgba(26,74,106,0.06);
  247. border-left: 3px solid var(--blue);
  248. padding: 10px 14px;
  249. font-size: 13px;
  250. font-style: italic;
  251. color: var(--ink-light);
  252. margin: 12px 0;
  253. min-height: 40px;
  254. }
  255. .nav {
  256. display: flex;
  257. justify-content: space-between;
  258. align-items: center;
  259. padding: 16px 30px;
  260. border-top: 2px solid var(--ink);
  261. background: var(--paper-dark);
  262. position: relative;
  263. z-index: 2;
  264. }
  265. button {
  266. font-family: 'Oswald', sans-serif;
  267. font-size: 14px;
  268. font-weight: 500;
  269. letter-spacing: 1px;
  270. text-transform: uppercase;
  271. padding: 10px 24px;
  272. border: 2px solid var(--ink);
  273. background: var(--paper);
  274. color: var(--ink);
  275. cursor: pointer;
  276. transition: all 0.15s;
  277. }
  278. button:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
  279. button:disabled { opacity: 0.3; cursor: not-allowed; }
  280. button.primary { background: var(--red); color: #fff; border-color: var(--red); }
  281. button.primary:hover:not(:disabled) { background: var(--red-light); border-color: var(--red-light); }
  282. button.ghost { background: transparent; }
  283. .channel-diagram {
  284. display: flex;
  285. align-items: center;
  286. justify-content: center;
  287. gap: 0;
  288. margin: 24px 0;
  289. flex-wrap: wrap;
  290. }
  291. .channel-block {
  292. background: #fffef8;
  293. border: 2px solid var(--ink);
  294. padding: 12px 20px;
  295. text-align: center;
  296. min-width: 140px;
  297. }
  298. .channel-block .label {
  299. font-family: 'Roboto Mono', monospace;
  300. font-size: 10px;
  301. letter-spacing: 1px;
  302. color: var(--ink-light);
  303. text-transform: uppercase;
  304. margin-bottom: 4px;
  305. }
  306. .channel-block .name {
  307. font-family: 'Oswald', sans-serif;
  308. font-size: 16px;
  309. font-weight: 500;
  310. text-transform: uppercase;
  311. }
  312. .channel-arrow { font-size: 24px; color: var(--red); padding: 0 8px; font-family: 'Roboto Mono', monospace; }
  313. .channel-block.source { border-color: var(--red); }
  314. .channel-block.medium { border-color: var(--blue); }
  315. .channel-block.receiver { border-color: var(--green); }
  316. .mechanisms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
  317. @media (max-width: 640px) { .mechanisms { grid-template-columns: 1fr; } }
  318. .mech-card { border: 1px solid var(--line); background: #fffef8; padding: 12px; }
  319. .mech-card .mech-title { font-family: 'Oswald', sans-serif; font-size: 14px; text-transform: uppercase; margin-bottom: 6px; }
  320. .mech-card .mech-env { font-size: 12px; color: var(--ink-light); font-style: italic; }
  321. .mech-card.ind { border-top: 4px solid var(--red); }
  322. .mech-card.cap { border-top: 4px solid var(--blue); }
  323. .mech-card.gal { border-top: 4px solid var(--green); }
  324. .protection-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 13px; }
  325. .protection-table th {
  326. background: var(--ink); color: var(--paper); padding: 8px 10px; text-align: left;
  327. font-family: 'Oswald', sans-serif; font-weight: 500; text-transform: uppercase; font-size: 12px; letter-spacing: 0.5px;
  328. }
  329. .protection-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
  330. .protection-table tr:nth-child(even) td { background: rgba(0,0,0,0.02); }
  331. .question { margin: 20px 0; padding: 16px; background: #fffef8; border: 1px solid var(--line); }
  332. .question .q-num { font-family: 'Roboto Mono', monospace; font-size: 11px; color: var(--red); letter-spacing: 1px; margin-bottom: 4px; }
  333. .question .q-text { font-weight: 700; margin-bottom: 10px; font-size: 15px; }
  334. .question label { display: block; padding: 6px 10px; margin: 4px 0; cursor: pointer; border: 1px solid transparent; border-radius: 2px; font-size: 14px; }
  335. .question label:hover { background: rgba(26,42,74,0.05); }
  336. .question input[type=radio] { margin-right: 8px; accent-color: var(--red); }
  337. .question .explain { display: none; margin-top: 10px; padding: 10px; background: rgba(26,74,106,0.08); border-left: 3px solid var(--blue); font-size: 13px; font-style: italic; }
  338. .question .explain.show { display: block; }
  339. .question.correct { border-color: var(--green); }
  340. .question.incorrect { border-color: var(--red); }
  341. .question .result-mark { font-family: 'Roboto Mono', monospace; font-size: 12px; font-weight: 700; margin-top: 8px; }
  342. .question .result-mark.ok { color: var(--green); }
  343. .question .result-mark.bad { color: var(--red); }
  344. .checklist { background: #fffef8; border: 1px solid var(--line); padding: 16px; margin: 20px 0; }
  345. .checklist h4 { font-family: 'Oswald', sans-serif; font-size: 14px; text-transform: uppercase; margin: 0 0 10px; letter-spacing: 0.5px; }
  346. .checklist label { display: block; padding: 4px 0; font-size: 13px; cursor: pointer; }
  347. .checklist input[type=checkbox] { margin-right: 8px; accent-color: var(--green); }
  348. .final-score { text-align: center; padding: 30px 20px; background: #fffef8; border: 2px solid var(--ink); margin: 20px 0; }
  349. .final-score .num { font-family: 'Oswald', sans-serif; font-size: 56px; font-weight: 700; color: var(--red); line-height: 1; }
  350. .final-score .of { font-family: 'Roboto Mono', monospace; font-size: 14px; color: var(--ink-light); margin-top: 4px; }
  351. .final-score .verdict { font-family: 'Oswald', sans-serif; font-size: 18px; text-transform: uppercase; margin-top: 12px; letter-spacing: 1px; }
  352. #inductionCanvas { cursor: grab; touch-action: none; }
  353. #inductionCanvas.dragging { cursor: grabbing; }
  354. #inductiveViz { cursor: default; touch-action: none; }
  355. .hint { font-size: 12px; color: var(--ink-light); font-style: italic; margin-top: 8px; }
  356. @media (max-width: 640px) {
  357. body { padding: 10px; }
  358. .header { padding: 16px 20px 12px; }
  359. .header h1 { font-size: 20px; }
  360. .content { padding: 20px; }
  361. .nav { padding: 12px 20px; }
  362. button { padding: 8px 16px; font-size: 12px; }
  363. .channel-diagram { gap: 4px; }
  364. .channel-block { min-width: 100px; padding: 8px 10px; }
  365. .channel-arrow { font-size: 18px; padding: 0 2px; }
  366. }
  367. </style>
  368. </head>
  369. <body>
  370. <div class="app">
  371. <div class="header">
  372. <div class="header-top">
  373. <span>МДК.03.01 · Техническая защита информации</span>
  374. <span>3.1.400</span>
  375. </div>
  376. <h1>Электромагнитный канал утечки информации</h1>
  377. <div class="sub">Один канал — три механизма</div>
  378. </div>
  379. <div class="progress" id="progress"></div>
  380. <div class="content" id="content">
  381. <div class="scene active" data-scene="1">
  382. <div class="scene-num">Цель</div>
  383. <h2 class="scene-title">Что вы узнаете</h2>
  384. <p class="lead">Пройдите интерактив последовательно: сначала вспомним физику, потом разберём структуру канала, затем — три механизма наводок и защиту от каждого.</p>
  385. <div class="notebook">
  386. <p><strong>После прохождения вы сможете:</strong></p>
  387. <p>1. Объяснить, какие электромагнитные явления лежат в основе передачи информации и перехвата.</p>
  388. <p>2. Описать структуру канала: источник → среда → приёмник.</p>
  389. <p>3. Различить три механизма наводок по физической природе, а не по названию.</p>
  390. <p>4. Объяснить, почему защита от разных механизмов разная.</p>
  391. </div>
  392. <p class="hint">Ключевая мысль: электромагнитный канал один. Структура одна. Механизмов связи — три, и они разные физически.</p>
  393. </div>
  394. <div class="scene" data-scene="2">
  395. <div class="scene-num">Актуализация · 1 из 4</div>
  396. <h2 class="scene-title">Электрическое и магнитное поле</h2>
  397. <p>Вспомним два фундаментальных понятия. Они понадобятся, чтобы понять, почему наводки бывают разными.</p>
  398. <div class="two-col">
  399. <div class="viz">
  400. <canvas id="fieldE" width="400" height="180"></canvas>
  401. <div class="viz-caption">Электрическое поле: линии от зарядов</div>
  402. </div>
  403. <div class="viz">
  404. <canvas id="fieldB" width="400" height="180"></canvas>
  405. <div class="viz-caption">Магнитное поле: линии вокруг тока</div>
  406. </div>
  407. </div>
  408. <div class="notebook">
  409. <p><strong>Электрическое поле</strong> — создаётся электрическими зарядами, действует на заряды силой.</p>
  410. <p><strong>Магнитное поле</strong> — создаётся движущимися зарядами (током), действует на движущиеся заряды.</p>
  411. </div>
  412. </div>
  413. <div class="scene" data-scene="3">
  414. <div class="scene-num">Актуализация · 2 из 4</div>
  415. <h2 class="scene-title">Магнитное поле вокруг проводника с током</h2>
  416. <p>Подвигайте ползунок: чем больше ток, тем сильнее поле.</p>
  417. <div class="viz">
  418. <canvas id="wireB" width="800" height="220"></canvas>
  419. <div class="viz-caption">Концентрические линии магнитного поля вокруг провода</div>
  420. </div>
  421. <div class="control-group">
  422. <div class="control-label"><span>Ток, А</span><span class="val" id="currentVal2">5</span></div>
  423. <input type="range" id="currentSlider2" min="0" max="10" step="0.5" value="5">
  424. </div>
  425. <div class="notebook">
  426. <p>Вокруг проводника с током возникает магнитное поле. Чем больше ток, тем сильнее поле.</p>
  427. <p>Направление — по правилу буравчика: если вкручивать буравчик по току, рукоятка вращается по линиям поля.</p>
  428. </div>
  429. </div>
  430. <div class="scene" data-scene="4">
  431. <div class="scene-num">Актуализация · 3 из 4</div>
  432. <h2 class="scene-title">Возникновение тока при изменении магнитного поля</h2>
  433. <p>Зажмите магнит и тяните его к катушке или от неё. Чем ближе магнит — тем больше линий поля пронизывают катушку и тем они ярче. Стрелка гальванометра отклоняется, пока магнит движется. Остановите магнит — линии перестают меняться, стрелка возвращается в нуль.</p>
  434. <div class="viz">
  435. <canvas id="inductionCanvas" width="800" height="320"></canvas>
  436. <div class="viz-caption">Линии магнитного поля: чем ближе магнит, тем гуще и ярче · гальванометр показывает ЭДС</div>
  437. </div>
  438. <div class="indicator">
  439. <small>ЭДС = −dФ/dt</small>
  440. <span><span id="emfValue">0.0</span> мВ</span>
  441. </div>
  442. <div class="feedback" id="inductionFeedback">Зажмите магнит и двигайте его.</div>
  443. <div class="notebook">
  444. <p><strong>Электромагнитная индукция</strong> — при изменении магнитного потока через контур в нём возникает ЭДС (и ток, если контур замкнут).</p>
  445. <p>Закон Фарадея: <span class="formula">ЭДС = −dФ/dt</span>. Важно: ток возникает только при <em>изменении</em> потока, а не при постоянном поле.</p>
  446. </div>
  447. </div>
  448. <div class="scene" data-scene="5">
  449. <div class="scene-num">Актуализация · 4 из 4</div>
  450. <h2 class="scene-title">Конденсатор и индуктивность</h2>
  451. <p>Два элемента, которые накапливают энергию поля. Подвигайте ползунки — увидите, как меняется поле внутри и вокруг элемента.</p>
  452. <div class="two-col">
  453. <div class="viz">
  454. <canvas id="capacitorViz" width="400" height="200"></canvas>
  455. <div class="viz-caption">Конденсатор в разрезе: заряд и поле E между пластинами</div>
  456. <div class="control-group">
  457. <div class="control-label"><span>Заряд на пластинах</span><span class="val" id="capChargeVal">50</span>%</div>
  458. <input type="range" id="capCharge" min="0" max="100" step="5" value="50">
  459. </div>
  460. </div>
  461. <div class="viz">
  462. <canvas id="inductorViz" width="400" height="200"></canvas>
  463. <div class="viz-caption">Катушка индуктивности: ток и поле B вокруг витков</div>
  464. <div class="control-group">
  465. <div class="control-label"><span>Ток через катушку</span><span class="val" id="indCurrentVal3">50</span>%</div>
  466. <input type="range" id="indCurrent3" min="0" max="100" step="5" value="50">
  467. </div>
  468. </div>
  469. </div>
  470. <div class="notebook">
  471. <p><strong>Конденсатор</strong> — две проводящие пластины, разделённые диэлектриком. Накапливает заряд, создаёт электрическое поле между пластинами. Чем больше заряд — тем сильнее поле.</p>
  472. <p><strong>Индуктивность</strong> — свойство проводника накапливать энергию магнитного поля при протекании тока. Чем больше ток — тем сильнее поле.</p>
  473. </div>
  474. <p class="hint">Связь с наводками: два провода рядом образуют паразитный конденсатор (ёмкостная связь). Провод с током рядом с другим создаёт магнитное поле (индуктивная связь).</p>
  475. </div>
  476. <div class="scene" data-scene="6">
  477. <div class="scene-num">Новая тема · структура</div>
  478. <h2 class="scene-title">Структура канала передачи информации</h2>
  479. <p>Любой канал — от полезного сигнала до утечки — устроен одинаково: есть источник, среда и приёмник.</p>
  480. <div class="channel-diagram">
  481. <div class="channel-block source">
  482. <div class="label">Источник</div>
  483. <div class="name">Создаёт сигнал</div>
  484. </div>
  485. <div class="channel-arrow">→</div>
  486. <div class="channel-block medium">
  487. <div class="label">Среда</div>
  488. <div class="name">Переносит</div>
  489. </div>
  490. <div class="channel-arrow">→</div>
  491. <div class="channel-block receiver">
  492. <div class="label">Приёмник</div>
  493. <div class="name">Принимает</div>
  494. </div>
  495. </div>
  496. <div class="notebook">
  497. <p><strong>Канал передачи информации</strong> — путь от источника к приёмнику.</p>
  498. <p>Структура: <strong>источник</strong> (создаёт сигнал) → <strong>среда</strong> (переносит) → <strong>приёмник</strong> (принимает).</p>
  499. <p>В электромагнитном канале среда — это электрическое или магнитное поле, либо общий проводник.</p>
  500. </div>
  501. <p><strong>Ключевая мысль:</strong> те же явления злоумышленник использует для перехвата. Канал тот же, но работает против вас.</p>
  502. </div>
  503. <div class="scene" data-scene="7">
  504. <div class="scene-num">Новая тема · механизмы</div>
  505. <h2 class="scene-title">Наводки: три механизма одного канала</h2>
  506. <p>Наводка — это помеха в сигнальной цепи. Механизмов три, и они разные физически, хотя структура канала общая.</p>
  507. <div class="mechanisms">
  508. <div class="mech-card ind">
  509. <div class="mech-title">Индуктивный</div>
  510. <div class="mech-env">Среда — магнитное поле</div>
  511. </div>
  512. <div class="mech-card cap">
  513. <div class="mech-title">Ёмкостный</div>
  514. <div class="mech-env">Среда — электрическое поле</div>
  515. </div>
  516. <div class="mech-card gal">
  517. <div class="mech-title">Гальванический</div>
  518. <div class="mech-env">Среда — общий проводник</div>
  519. </div>
  520. </div>
  521. <div class="notebook">
  522. <p><strong>Наводка</strong> — помеха, наведённая в сигнальной цепи за счёт паразитной связи с другой цепью.</p>
  523. <p>Виды: <strong>индуктивная</strong> (через магнитное поле), <strong>ёмкостная</strong> (через электрическое поле), <strong>гальваническая</strong> (через общий проводник).</p>
  524. <p>Это один канал, три разных физических механизма. Структура общая: источник → среда → приёмник.</p>
  525. </div>
  526. </div>
  527. <div class="scene" data-scene="8">
  528. <div class="scene-num">Механизм 1 · индуктивный</div>
  529. <h2 class="scene-title">Индуктивная наводка</h2>
  530. <p>Источник — провод с переменным током. Среда — магнитное поле. Приёмник — петля сигнального провода. Меняйте ток, частоту, расстояние и площадь петли. Провод можно перетаскивать мышью, углы петли — тянуть и менять площадь.</p>
  531. <div class="viz">
  532. <canvas id="inductiveViz" width="800" height="440"></canvas>
  533. <div class="viz-caption">Плотность линий = интенсивность поля · мерцание = частота · стрелка в петле = наведённая ЭДС</div>
  534. </div>
  535. <div class="two-col">
  536. <div>
  537. <div class="control-group">
  538. <div class="control-label"><span>Ток источника, А</span><span class="val" id="indCurrentVal">5</span></div>
  539. <input type="range" id="indCurrent" min="0" max="10" step="0.5" value="5">
  540. </div>
  541. <div class="control-group">
  542. <div class="control-label"><span>Частота, Гц</span><span class="val" id="indFreqVal">500</span></div>
  543. <input type="range" id="indFreq" min="0" max="1000" step="50" value="500">
  544. </div>
  545. </div>
  546. <div>
  547. <div class="control-group">
  548. <div class="control-label"><span>Расстояние, см</span><span class="val" id="indDistVal">10</span></div>
  549. <input type="range" id="indDist" min="1" max="20" step="1" value="10">
  550. </div>
  551. <div class="control-group">
  552. <div class="control-label"><span>Площадь петли, см²</span><span class="val" id="indAreaVal">50</span></div>
  553. <input type="range" id="indArea" min="0" max="100" step="5" value="50">
  554. </div>
  555. </div>
  556. </div>
  557. <div class="indicator">
  558. <small>Мгновенная ЭДС = −dФ/dt</small>
  559. <span><span id="indResult">0.0</span> мВ</span>
  560. </div>
  561. <div class="feedback" id="indFeedback">Двигайте ползунки или перетаскивайте провод и углы петли.</div>
  562. <div class="notebook">
  563. <p><strong>Индуктивная наводка</strong> — наведение ЭДС в контуре за счёт изменения магнитного потока от соседнего проводника с током.</p>
  564. <p>Зависит от тока, частоты, площади петли и расстояния. При постоянном токе (частота = 0) наводки нет — поток не меняется.</p>
  565. </div>
  566. </div>
  567. <div class="scene" data-scene="9">
  568. <div class="scene-num">Механизм 2 · ёмкостный</div>
  569. <h2 class="scene-title">Ёмкостная наводка</h2>
  570. <p>Источник — провод с переменным напряжением. Среда — электрическое поле. Приёмник — провод или плата, на которой наводится заряд. Два провода рядом образуют паразитный конденсатор.</p>
  571. <div class="viz">
  572. <canvas id="capacitiveViz" width="800" height="240"></canvas>
  573. <div class="viz-caption">Электрическое поле между проводами</div>
  574. </div>
  575. <div class="two-col">
  576. <div>
  577. <div class="control-group">
  578. <div class="control-label"><span>Напряжение, В</span><span class="val" id="capVoltVal">500</span></div>
  579. <input type="range" id="capVolt" min="0" max="1000" step="50" value="500">
  580. </div>
  581. <div class="control-group">
  582. <div class="control-label"><span>Частота, Гц</span><span class="val" id="capFreqVal">500</span></div>
  583. <input type="range" id="capFreq" min="0" max="1000" step="50" value="500">
  584. </div>
  585. </div>
  586. <div>
  587. <div class="control-group">
  588. <div class="control-label"><span>Расстояние, см</span><span class="val" id="capDistVal">10</span></div>
  589. <input type="range" id="capDist" min="1" max="20" step="1" value="10">
  590. </div>
  591. <div class="control-group">
  592. <div class="control-label"><span>Площадь, см²</span><span class="val" id="capAreaVal">50</span></div>
  593. <input type="range" id="capArea" min="0" max="100" step="5" value="50">
  594. </div>
  595. </div>
  596. </div>
  597. <div class="indicator">
  598. <small>Наведённое напряжение</small>
  599. <span><span id="capResult">0.0</span> мВ</span>
  600. </div>
  601. <div class="feedback" id="capFeedback">Двигайте ползунки, чтобы увидеть, как меняется наводка.</div>
  602. <div class="notebook">
  603. <p><strong>Ёмкостная наводка</strong> — наведение напряжения в проводнике за счёт электрического поля соседнего проводника с переменным напряжением.</p>
  604. <p>Зависит от напряжения, частоты, площади и расстояния. При постоянном напряжении (частота = 0) наводки нет — нет изменения заряда.</p>
  605. </div>
  606. </div>
  607. <div class="scene" data-scene="10">
  608. <div class="scene-num">Механизм 3 · гальванический</div>
  609. <h2 class="scene-title">Гальваническая наводка</h2>
  610. <p>Источник и приёмник связаны общим проводом (землёй, питанием). Ток от силовой нагрузки течёт по общему участку, на его сопротивлении падает напряжение — и это падение попадает в сигнальную цепь.</p>
  611. <div class="viz">
  612. <canvas id="galvanicViz" width="800" height="240"></canvas>
  613. <div class="viz-caption">Общий проводник с сопротивлением R: падение напряжения U = I·R</div>
  614. </div>
  615. <div class="two-col">
  616. <div>
  617. <div class="control-group">
  618. <div class="control-label"><span>Ток в общей цепи, А</span><span class="val" id="galCurrentVal">5</span></div>
  619. <input type="range" id="galCurrent" min="0" max="10" step="0.5" value="5">
  620. </div>
  621. <div class="control-group">
  622. <div class="control-label"><span>Сопротивление, Ом</span><span class="val" id="galResVal">0.50</span></div>
  623. <input type="range" id="galRes" min="0" max="1" step="0.05" value="0.5">
  624. </div>
  625. </div>
  626. <div>
  627. <div class="control-group">
  628. <div class="control-label"><span>Качество заземления, %</span><span class="val" id="galGroundVal">50</span></div>
  629. <input type="range" id="galGround" min="0" max="100" step="5" value="50">
  630. </div>
  631. </div>
  632. </div>
  633. <div class="indicator">
  634. <small>Помеха в сигнальной цепи</small>
  635. <span><span id="galResult">0.0</span> мВ</span>
  636. </div>
  637. <div class="feedback" id="galFeedback">Двигайте ползунки, чтобы увидеть, как меняется помеха.</div>
  638. <div class="notebook">
  639. <p><strong>Гальваническая наводка</strong> — помеха, попадающая в сигнальную цепь через общий проводник (землю, питание) за счёт падения напряжения на его сопротивлении.</p>
  640. <p>Зависит от тока, сопротивления общего участка и качества заземления. По закону Ома: <span class="formula">U = I·R</span>.</p>
  641. </div>
  642. </div>
  643. <div class="scene" data-scene="11">
  644. <div class="scene-num">Применение · защита</div>
  645. <h2 class="scene-title">Как защищаться от каждого механизма</h2>
  646. <p>Механизмы разные — значит, и защита разная. Один и тот же способ не работает одинаково против всех трёх.</p>
  647. <table class="protection-table">
  648. <thead>
  649. <tr>
  650. <th>Механизм</th>
  651. <th>От чего зависит</th>
  652. <th>Защита</th>
  653. </tr>
  654. </thead>
  655. <tbody>
  656. <tr>
  657. <td><strong>Индуктивный</strong></td>
  658. <td>Ток, частота, площадь петли, расстояние</td>
  659. <td>Разнос, витая пара, экран из магнитного материала</td>
  660. </tr>
  661. <tr>
  662. <td><strong>Ёмкостный</strong></td>
  663. <td>Напряжение, частота, площадь, расстояние</td>
  664. <td>Экран (электростатический), разнос, заземление экрана</td>
  665. </tr>
  666. <tr>
  667. <td><strong>Гальванический</strong></td>
  668. <td>Ток, сопротивление общего участка, заземление</td>
  669. <td>Разрыв общей цепи (оптрон, трансформатор), правильное заземление</td>
  670. </tr>
  671. </tbody>
  672. </table>
  673. <div class="notebook">
  674. <p><strong>От индуктивной</strong> — разнос, витая пара, экран из магнитного материала.</p>
  675. <p><strong>От ёмкостной</strong> — экран (электростатический), разнос, заземление экрана.</p>
  676. <p><strong>От гальванической</strong> — разрыв общей цепи (оптрон, трансформатор), правильное заземление.</p>
  677. </div>
  678. <p><strong>Ключевая мысль:</strong> защита разная, потому что механизмы разные. Экран от ёмкостной работает, от гальванической — нет.</p>
  679. </div>
  680. <div class="scene" data-scene="12">
  681. <div class="scene-num">Проверка</div>
  682. <h2 class="scene-title">Тест: проверьте понимание</h2>
  683. <p>Ответьте на вопросы. После каждого ответа — пояснение. В конце — результат и чек-лист конспекта.</p>
  684. <div id="quizContainer"></div>
  685. <div id="quizResult" style="display:none;"></div>
  686. <div class="checklist" id="finalChecklist" style="display:none;">
  687. <h4>Проверь, что записал в тетрадь</h4>
  688. <label><input type="checkbox"> Определение электрического и магнитного поля</label>
  689. <label><input type="checkbox"> Электромагнитная индукция (закон Фарадея)</label>
  690. <label><input type="checkbox"> Конденсатор и индуктивность</label>
  691. <label><input type="checkbox"> Структура канала: источник → среда → приёмник</label>
  692. <label><input type="checkbox"> Определение наводки</label>
  693. <label><input type="checkbox"> Три механизма: индуктивный, ёмкостный, гальванический</label>
  694. <label><input type="checkbox"> Зависимости каждого механизма</label>
  695. <label><input type="checkbox"> Защита от каждого механизма</label>
  696. </div>
  697. </div>
  698. </div>
  699. <div class="nav">
  700. <button id="prevBtn" class="ghost" disabled>← Назад</button>
  701. <span id="navLabel" style="font-family: 'Roboto Mono', monospace; font-size: 12px; color: var(--ink-light);"></span>
  702. <button id="nextBtn" class="primary">Дальше →</button>
  703. </div>
  704. </div>
  705. <script>
  706. (function() {
  707. 'use strict';
  708. const scenes = document.querySelectorAll('.scene');
  709. const totalScenes = scenes.length;
  710. const progress = document.getElementById('progress');
  711. const prevBtn = document.getElementById('prevBtn');
  712. const nextBtn = document.getElementById('nextBtn');
  713. const navLabel = document.getElementById('navLabel');
  714. let current = 0;
  715. for (let i = 0; i < totalScenes; i++) {
  716. const step = document.createElement('div');
  717. step.className = 'progress-step';
  718. progress.appendChild(step);
  719. }
  720. const progressSteps = progress.querySelectorAll('.progress-step');
  721. function showScene(index) {
  722. scenes.forEach((s, i) => s.classList.toggle('active', i === index));
  723. progressSteps.forEach((s, i) => {
  724. s.classList.toggle('done', i < index);
  725. s.classList.toggle('current', i === index);
  726. });
  727. prevBtn.disabled = index === 0;
  728. nextBtn.textContent = index === totalScenes - 1 ? 'К началу' : 'Дальше →';
  729. navLabel.textContent = (index + 1) + ' / ' + totalScenes;
  730. if (index === 1) initFields();
  731. if (index === 2) drawWireB();
  732. if (index === 3) initInductionScene();
  733. if (index === 4) { drawCapacitor(); drawInductor(); }
  734. if (index === 7) initInductive();
  735. if (index === 8) drawCapacitive();
  736. if (index === 9) drawGalvanic();
  737. if (index === 11) initQuiz();
  738. window.scrollTo({ top: 0, behavior: 'smooth' });
  739. }
  740. prevBtn.addEventListener('click', () => {
  741. if (current > 0) { current--; showScene(current); }
  742. });
  743. nextBtn.addEventListener('click', () => {
  744. if (current < totalScenes - 1) { current++; showScene(current); }
  745. else { current = 0; showScene(0); }
  746. });
  747. function initFields() {
  748. const eCanvas = document.getElementById('fieldE');
  749. const eCtx = eCanvas.getContext('2d');
  750. const bCanvas = document.getElementById('fieldB');
  751. const bCtx = bCanvas.getContext('2d');
  752. eCtx.clearRect(0, 0, 400, 180);
  753. eCtx.fillStyle = '#f2e9d6';
  754. eCtx.fillRect(0, 0, 400, 180);
  755. eCtx.fillStyle = '#8b1a1a';
  756. eCtx.beginPath(); eCtx.arc(100, 90, 14, 0, Math.PI*2); eCtx.fill();
  757. eCtx.fillStyle = '#1a4a6a';
  758. eCtx.beginPath(); eCtx.arc(300, 90, 14, 0, Math.PI*2); eCtx.fill();
  759. eCtx.fillStyle = '#fff';
  760. eCtx.font = 'bold 16px serif';
  761. eCtx.textAlign = 'center'; eCtx.textBaseline = 'middle';
  762. eCtx.fillText('+', 100, 90);
  763. eCtx.fillText('−', 300, 90);
  764. eCtx.strokeStyle = 'rgba(139,26,26,0.4)';
  765. eCtx.lineWidth = 1.5;
  766. for (let i = 0; i < 8; i++) {
  767. const y = 30 + i * 18;
  768. eCtx.beginPath();
  769. eCtx.moveTo(114, 90);
  770. eCtx.quadraticCurveTo(200, y, 286, 90);
  771. eCtx.stroke();
  772. }
  773. bCtx.clearRect(0, 0, 400, 180);
  774. bCtx.fillStyle = '#f2e9d6';
  775. bCtx.fillRect(0, 0, 400, 180);
  776. bCtx.fillStyle = '#1a2a4a';
  777. bCtx.fillRect(190, 20, 20, 140);
  778. bCtx.fillStyle = '#fff';
  779. bCtx.font = '12px monospace';
  780. bCtx.textAlign = 'center';
  781. bCtx.fillText('I', 200, 95);
  782. bCtx.strokeStyle = 'rgba(26,74,106,0.4)';
  783. bCtx.lineWidth = 1.5;
  784. for (let r = 30; r <= 90; r += 15) {
  785. bCtx.beginPath();
  786. bCtx.arc(200, 90, r, 0, Math.PI*2);
  787. bCtx.stroke();
  788. }
  789. }
  790. function drawWireB() {
  791. const canvas = document.getElementById('wireB');
  792. const ctx = canvas.getContext('2d');
  793. const current = parseFloat(document.getElementById('currentSlider2').value);
  794. const w = canvas.width, h = canvas.height;
  795. ctx.fillStyle = '#f2e9d6';
  796. ctx.fillRect(0, 0, w, h);
  797. ctx.fillStyle = '#1a2a4a';
  798. ctx.fillRect(390, 20, 20, h - 40);
  799. ctx.fillStyle = '#fff';
  800. ctx.font = 'bold 14px monospace';
  801. ctx.textAlign = 'center';
  802. ctx.fillText('I', 400, h/2);
  803. const maxR = 200;
  804. const lineCount = Math.floor(current * 2);
  805. ctx.strokeStyle = 'rgba(139,26,26,0.35)';
  806. ctx.lineWidth = 1.5;
  807. for (let i = 1; i <= lineCount; i++) {
  808. const r = (i / lineCount) * maxR;
  809. ctx.beginPath();
  810. ctx.ellipse(400, h/2, r * 0.6, r * 1.1, 0, 0, Math.PI*2);
  811. ctx.stroke();
  812. }
  813. ctx.fillStyle = '#4a5a7a';
  814. ctx.font = '13px serif';
  815. ctx.textAlign = 'center';
  816. ctx.fillText('Ток: ' + current + ' А', 400, h - 12);
  817. }
  818. document.getElementById('currentSlider2').addEventListener('input', function() {
  819. document.getElementById('currentVal2').textContent = this.value;
  820. drawWireB();
  821. });
  822. // === СЦЕНА 4: Индукция ===
  823. const induction = {
  824. canvas: null, ctx: null,
  825. magnet: { x: 100, y: 130, w: 70, h: 60, dragging: false, offsetX: 0 },
  826. coil: { x: 520, y: 110, w: 100, h: 100 },
  827. flux: 0, prevFlux: 0, lastTime: 0,
  828. emf: 0, displayEmf: 0,
  829. initialized: false,
  830. minX: 20, maxX: 440
  831. };
  832. function initInductionScene() {
  833. const c = document.getElementById('inductionCanvas');
  834. if (!c) return;
  835. if (induction.initialized) {
  836. induction.canvas = c;
  837. induction.ctx = c.getContext('2d');
  838. return;
  839. }
  840. induction.canvas = c;
  841. induction.ctx = c.getContext('2d');
  842. induction.initialized = true;
  843. c.addEventListener('mousedown', onIndDown);
  844. c.addEventListener('mousemove', onIndMove);
  845. c.addEventListener('mouseup', onIndUp);
  846. c.addEventListener('mouseleave', onIndUp);
  847. c.addEventListener('touchstart', onIndDown, { passive: false });
  848. c.addEventListener('touchmove', onIndMove, { passive: false });
  849. c.addEventListener('touchend', onIndUp);
  850. c.addEventListener('touchcancel', onIndUp);
  851. induction.lastTime = performance.now();
  852. requestAnimationFrame(drawInduction);
  853. }
  854. function getCanvasCoords(e, canvas) {
  855. const rect = canvas.getBoundingClientRect();
  856. const scaleX = canvas.width / rect.width;
  857. const scaleY = canvas.height / rect.height;
  858. let cx, cy;
  859. if (e.touches && e.touches.length) {
  860. cx = e.touches[0].clientX;
  861. cy = e.touches[0].clientY;
  862. } else {
  863. cx = e.clientX;
  864. cy = e.clientY;
  865. }
  866. return { x: (cx - rect.left) * scaleX, y: (cy - rect.top) * scaleY };
  867. }
  868. function onIndDown(e) {
  869. e.preventDefault();
  870. const p = getCanvasCoords(e, induction.canvas);
  871. const m = induction.magnet;
  872. if (p.x >= m.x && p.x <= m.x + m.w && p.y >= m.y && p.y <= m.y + m.h) {
  873. m.dragging = true;
  874. m.offsetX = p.x - m.x;
  875. induction.canvas.classList.add('dragging');
  876. }
  877. }
  878. function onIndMove(e) {
  879. if (!induction.magnet.dragging) return;
  880. e.preventDefault();
  881. const p = getCanvasCoords(e, induction.canvas);
  882. let newX = p.x - induction.magnet.offsetX;
  883. newX = Math.max(induction.minX, Math.min(induction.maxX, newX));
  884. induction.magnet.x = newX;
  885. }
  886. function onIndUp() {
  887. if (induction.magnet.dragging) {
  888. induction.magnet.dragging = false;
  889. induction.canvas.classList.remove('dragging');
  890. }
  891. }
  892. function drawInduction() {
  893. const sceneEl = document.querySelector('.scene[data-scene="4"]');
  894. if (!sceneEl || !sceneEl.classList.contains('active')) {
  895. requestAnimationFrame(drawInduction);
  896. return;
  897. }
  898. if (!induction.ctx) {
  899. requestAnimationFrame(drawInduction);
  900. return;
  901. }
  902. const now = performance.now();
  903. const dt = (now - induction.lastTime) / 1000;
  904. induction.lastTime = now;
  905. const m = induction.magnet;
  906. const c = induction.coil;
  907. const magnetCenterX = m.x + m.w / 2;
  908. const coilCenterX = c.x + c.w / 2;
  909. const dist = Math.abs(magnetCenterX - coilCenterX);
  910. const flux = 1000 / (dist * dist + 5000);
  911. if (dt > 0.001 && dt < 0.3) {
  912. const dflux = flux - induction.flux;
  913. const emfRaw = -(dflux / dt) * 2000;
  914. induction.emf = Math.max(-100, Math.min(100, emfRaw));
  915. } else {
  916. induction.emf = induction.emf * 0.9;
  917. }
  918. induction.flux = flux;
  919. induction.displayEmf += (induction.emf - induction.displayEmf) * 0.25;
  920. if (Math.abs(induction.displayEmf) < 0.5) induction.displayEmf = 0;
  921. renderInduction();
  922. const emfEl = document.getElementById('emfValue');
  923. if (emfEl) emfEl.textContent = induction.displayEmf.toFixed(1);
  924. const fbEl = document.getElementById('inductionFeedback');
  925. if (fbEl) {
  926. const speed = Math.abs(induction.displayEmf);
  927. if (speed < 1) fbEl.textContent = 'Магнит неподвижен → поток не меняется → ЭДС = 0.';
  928. else if (speed < 30) fbEl.textContent = 'Магнит движется медленно → поток меняется медленно → ЭДС небольшая.';
  929. else fbEl.textContent = 'Магнит движется быстро → поток меняется быстро → ЭДС большая.';
  930. }
  931. requestAnimationFrame(drawInduction);
  932. }
  933. function renderInduction() {
  934. const c = induction.canvas;
  935. const ctx = induction.ctx;
  936. if (!c || !ctx) return;
  937. const w = c.width, h = c.height;
  938. ctx.fillStyle = '#f2e9d6';
  939. ctx.fillRect(0, 0, w, h);
  940. const m = induction.magnet;
  941. const coil = induction.coil;
  942. const magnetCenterX = m.x + m.w / 2;
  943. const coilCenterX = coil.x + coil.w / 2;
  944. const dist = Math.abs(magnetCenterX - coilCenterX);
  945. const flux = 1000 / (dist * dist + 5000);
  946. const reach = Math.max(0, Math.min(1, 1 - (dist - 60) / 400));
  947. ctx.strokeStyle = '#1a2a4a';
  948. ctx.lineWidth = 3;
  949. for (let i = 0; i < 5; i++) {
  950. const rx = 15 + i * 2;
  951. const x = coil.x + 20 + i * 12;
  952. ctx.beginPath();
  953. ctx.ellipse(x, coil.y + coil.h/2, rx, coil.h/2, 0, 0, Math.PI * 2);
  954. ctx.stroke();
  955. }
  956. ctx.fillStyle = '#4a5a7a';
  957. ctx.font = '12px "Roboto Mono", monospace';
  958. ctx.textAlign = 'center';
  959. ctx.fillText('катушка', coil.x + coil.w/2, coil.y + coil.h + 20);
  960. if (reach > 0.4) {
  961. const glow = (reach - 0.4) / 0.6;
  962. const grad = ctx.createRadialGradient(
  963. coilCenterX, coil.y + coil.h/2, 20,
  964. coilCenterX, coil.y + coil.h/2, coil.w
  965. );
  966. grad.addColorStop(0, `rgba(255,140,50,${glow * 0.25})`);
  967. grad.addColorStop(1, 'rgba(255,140,50,0)');
  968. ctx.fillStyle = grad;
  969. ctx.fillRect(coil.x - 80, coil.y - 60, coil.w + 160, coil.h + 120);
  970. }
  971. const nX = m.x + m.w;
  972. const sX = m.x;
  973. const myCenter = m.y + m.h / 2;
  974. const numFlux = Math.max(3, Math.round(3 + reach * 10));
  975. const spread = m.h * (0.35 + reach * 0.35);
  976. const rightEndX = coil.x + 15;
  977. const rightLen = rightEndX - nX;
  978. const leftEndX = Math.max(10, sX - rightLen);
  979. const alpha = 0.1 + reach * 0.9;
  980. const lineWidth = 0.8 + reach * 2.2;
  981. const rCol = Math.floor(139 + reach * 80);
  982. const gCol = Math.floor(20 + reach * 130);
  983. const bCol = Math.floor(20 + reach * 30);
  984. const shadowCol = `rgba(255,140,50,${reach * 0.7})`;
  985. const shadowBlur = reach * 12;
  986. function drawFluxLine(x1, startY, x2, endY, curvature) {
  987. ctx.strokeStyle = `rgba(${rCol},${gCol},${bCol},${alpha})`;
  988. ctx.lineWidth = lineWidth;
  989. if (reach > 0.3) {
  990. ctx.shadowColor = shadowCol;
  991. ctx.shadowBlur = shadowBlur;
  992. }
  993. ctx.beginPath();
  994. ctx.moveTo(x1, startY);
  995. const midX = (x1 + x2) / 2;
  996. const midY = (startY + endY) / 2 + curvature;
  997. ctx.quadraticCurveTo(midX, midY, x2, endY);
  998. ctx.stroke();
  999. ctx.shadowBlur = 0;
  1000. ctx.shadowColor = 'transparent';
  1001. }
  1002. for (let i = 0; i < numFlux; i++) {
  1003. const t = numFlux === 1 ? 0.5 : i / (numFlux - 1);
  1004. const rel = (t - 0.5) * 2;
  1005. const startY = myCenter + rel * spread;
  1006. const rightEndY = myCenter + rel * (spread + coil.h * 0.3 * reach);
  1007. drawFluxLine(nX, startY, rightEndX, rightEndY, rel * 15);
  1008. const leftEndY = myCenter + rel * spread;
  1009. drawFluxLine(sX, startY, leftEndX, leftEndY, rel * 15);
  1010. }
  1011. ctx.fillStyle = '#1a4a6a';
  1012. ctx.fillRect(m.x, m.y, m.w / 2, m.h);
  1013. ctx.fillStyle = '#8b1a1a';
  1014. ctx.fillRect(m.x + m.w / 2, m.y, m.w / 2, m.h);
  1015. ctx.strokeStyle = '#1a2a4a';
  1016. ctx.lineWidth = 2;
  1017. ctx.strokeRect(m.x, m.y, m.w, m.h);
  1018. ctx.fillStyle = '#fff';
  1019. ctx.font = 'bold 20px "PT Serif", serif';
  1020. ctx.textAlign = 'center';
  1021. ctx.textBaseline = 'middle';
  1022. ctx.fillText('S', m.x + m.w / 4, m.y + m.h / 2);
  1023. ctx.fillText('N', m.x + 3 * m.w / 4, m.y + m.h / 2);
  1024. ctx.textBaseline = 'alphabetic';
  1025. const gx = 700, gy = 200, gr = 50;
  1026. ctx.beginPath();
  1027. ctx.arc(gx, gy, gr, 0, Math.PI * 2);
  1028. ctx.fillStyle = '#fffef8';
  1029. ctx.fill();
  1030. ctx.strokeStyle = '#1a2a4a';
  1031. ctx.lineWidth = 2;
  1032. ctx.stroke();
  1033. ctx.strokeStyle = '#4a5a7a';
  1034. ctx.lineWidth = 1;
  1035. for (let a = -60; a <= 60; a += 15) {
  1036. const rad = (a - 90) * Math.PI / 180;
  1037. const x1 = gx + Math.cos(rad) * (gr - 10);
  1038. const y1 = gy + Math.sin(rad) * (gr - 10);
  1039. const x2 = gx + Math.cos(rad) * (gr - 2);
  1040. const y2 = gy + Math.sin(rad) * (gr - 2);
  1041. ctx.beginPath();
  1042. ctx.moveTo(x1, y1);
  1043. ctx.lineTo(x2, y2);
  1044. ctx.stroke();
  1045. }
  1046. ctx.fillStyle = '#4a5a7a';
  1047. ctx.font = '10px monospace';
  1048. ctx.textAlign = 'center';
  1049. ctx.fillText('0', gx, gy - gr + 12);
  1050. const angle = (induction.displayEmf / 100) * 45;
  1051. const rad = (angle - 90) * Math.PI / 180;
  1052. const arrowLen = gr - 8;
  1053. ctx.strokeStyle = '#8b1a1a';
  1054. ctx.lineWidth = 3;
  1055. ctx.beginPath();
  1056. ctx.moveTo(gx, gy);
  1057. ctx.lineTo(gx + Math.cos(rad) * arrowLen, gy + Math.sin(rad) * arrowLen);
  1058. ctx.stroke();
  1059. ctx.fillStyle = '#1a2a4a';
  1060. ctx.beginPath();
  1061. ctx.arc(gx, gy, 5, 0, Math.PI * 2);
  1062. ctx.fill();
  1063. ctx.fillStyle = '#4a5a7a';
  1064. ctx.font = '12px "Roboto Mono", monospace';
  1065. ctx.fillText('гальванометр', gx, gy + gr + 18);
  1066. ctx.font = '14px "Roboto Mono", monospace';
  1067. ctx.fillStyle = '#8b1a1a';
  1068. ctx.fillText('−', gx - gr - 12, gy - 5);
  1069. ctx.fillText('+', gx + gr + 12, gy - 5);
  1070. }
  1071. // === СЦЕНА 5: Конденсатор и индуктивность ===
  1072. function drawCapacitor() {
  1073. const c = document.getElementById('capacitorViz');
  1074. if (!c) return;
  1075. const ctx = c.getContext('2d');
  1076. const charge = parseFloat(document.getElementById('capCharge').value);
  1077. const w = c.width, h = c.height;
  1078. ctx.fillStyle = '#f2e9d6';
  1079. ctx.fillRect(0, 0, w, h);
  1080. const plateW = 16;
  1081. const plateH = 120;
  1082. const leftX = 80;
  1083. const rightX = w - 80 - plateW;
  1084. const topY = (h - plateH) / 2;
  1085. ctx.fillStyle = '#8b1a1a';
  1086. ctx.fillRect(leftX, topY, plateW, plateH);
  1087. ctx.fillStyle = '#1a4a6a';
  1088. ctx.fillRect(rightX, topY, plateW, plateH);
  1089. const numCharges = Math.floor(charge / 10);
  1090. if (numCharges > 0) {
  1091. const signY0 = topY + 30;
  1092. const signYStep = (plateH - 60) / Math.max(1, numCharges - 1);
  1093. ctx.fillStyle = '#fff';
  1094. ctx.font = 'bold 14px serif';
  1095. ctx.textAlign = 'center';
  1096. ctx.textBaseline = 'middle';
  1097. for (let i = 0; i < numCharges; i++) {
  1098. const y = signY0 + i * signYStep;
  1099. ctx.fillText('+', leftX + plateW/2, y);
  1100. ctx.fillText('−', rightX + plateW/2, y);
  1101. }
  1102. }
  1103. if (charge > 0) {
  1104. const lines = Math.max(1, Math.floor(charge / 12));
  1105. const alpha = 0.15 + (charge / 100) * 0.75;
  1106. const lw = 1 + (charge / 100) * 2;
  1107. ctx.strokeStyle = `rgba(139,26,26,${alpha})`;
  1108. ctx.lineWidth = lw;
  1109. for (let i = 0; i < lines; i++) {
  1110. const y = topY + 20 + i * (plateH - 40) / Math.max(1, lines - 1);
  1111. ctx.beginPath();
  1112. ctx.moveTo(leftX + plateW, y);
  1113. ctx.lineTo(rightX, y);
  1114. ctx.stroke();
  1115. }
  1116. }
  1117. ctx.fillStyle = '#8b1a1a';
  1118. ctx.font = 'bold 13px "Roboto Mono", monospace';
  1119. ctx.textAlign = 'center';
  1120. ctx.textBaseline = 'alphabetic';
  1121. ctx.fillText('E', w/2, topY - 10);
  1122. ctx.fillStyle = '#4a5a7a';
  1123. ctx.font = '11px "Roboto Mono", monospace';
  1124. ctx.fillText('диэлектрик', w/2, h - 12);
  1125. ctx.font = '11px "Roboto Mono", monospace';
  1126. ctx.textAlign = 'left';
  1127. ctx.fillText('+', leftX - 18, topY + plateH/2);
  1128. ctx.textAlign = 'right';
  1129. ctx.fillText('−', rightX + plateW + 18, topY + plateH/2);
  1130. }
  1131. function drawInductor() {
  1132. const c = document.getElementById('inductorViz');
  1133. if (!c) return;
  1134. const ctx = c.getContext('2d');
  1135. const current = parseFloat(document.getElementById('indCurrent3').value);
  1136. const w = c.width, h = c.height;
  1137. ctx.fillStyle = '#f2e9d6';
  1138. ctx.fillRect(0, 0, w, h);
  1139. const coilCX = w/2;
  1140. const coilCY = h/2 + 10;
  1141. const coilW = 180;
  1142. const coilH = 100;
  1143. const turns = 5;
  1144. if (current > 0) {
  1145. const lineCount = Math.max(1, Math.floor(current / 12));
  1146. const alpha = 0.15 + (current / 100) * 0.75;
  1147. const lw = 1 + (current / 100) * 2;
  1148. const maxR = 55;
  1149. ctx.strokeStyle = `rgba(139,26,26,${alpha})`;
  1150. ctx.lineWidth = lw;
  1151. for (let i = 0; i < lineCount; i++) {
  1152. const r = 12 + i * (maxR - 12) / Math.max(1, lineCount - 1);
  1153. ctx.beginPath();
  1154. ctx.ellipse(coilCX, coilCY, coilW/2 + r, coilH/2 + r*0.7, 0, 0, Math.PI*2);
  1155. ctx.stroke();
  1156. }
  1157. }
  1158. ctx.strokeStyle = '#1a2a4a';
  1159. ctx.lineWidth = 4;
  1160. for (let i = 0; i < turns; i++) {
  1161. const x = coilCX - coilW/2 + (i + 0.5) * (coilW / turns);
  1162. const rx = (coilW / turns) * 0.55;
  1163. ctx.beginPath();
  1164. ctx.ellipse(x, coilCY, rx, coilH/2, 0, 0, Math.PI*2);
  1165. ctx.stroke();
  1166. }
  1167. ctx.fillStyle = '#8b1a1a';
  1168. ctx.font = 'bold 13px "Roboto Mono", monospace';
  1169. ctx.textAlign = 'left';
  1170. ctx.textBaseline = 'alphabetic';
  1171. ctx.fillText('B', 20, 24);
  1172. ctx.fillStyle = '#4a5a7a';
  1173. ctx.font = '11px "Roboto Mono", monospace';
  1174. ctx.textAlign = 'center';
  1175. ctx.fillText('витки', coilCX, h - 12);
  1176. }
  1177. document.getElementById('capCharge').addEventListener('input', function() {
  1178. document.getElementById('capChargeVal').textContent = this.value;
  1179. drawCapacitor();
  1180. });
  1181. document.getElementById('indCurrent3').addEventListener('input', function() {
  1182. document.getElementById('indCurrentVal3').textContent = this.value;
  1183. drawInductor();
  1184. });
  1185. // === СЦЕНА 8: Индуктивная наводка (расширенная) ===
  1186. const ind8 = {
  1187. canvas: null,
  1188. ctx: null,
  1189. wire: { x: 370, w: 22, h: 260, cy: 220 },
  1190. loop: { x1: 560, y1: 150, w: 120, h: 105 },
  1191. pxPerCm: 18,
  1192. phase: 0,
  1193. lastT: 0,
  1194. dragMode: null,
  1195. dragOffset: { x: 0, y: 0 },
  1196. initialized: false
  1197. };
  1198. function initInductive() {
  1199. const c = document.getElementById('inductiveViz');
  1200. if (!c) return;
  1201. ind8.canvas = c;
  1202. ind8.ctx = c.getContext('2d');
  1203. if (!ind8.initialized) {
  1204. ind8.initialized = true;
  1205. c.addEventListener('mousedown', onInd8Down);
  1206. c.addEventListener('mousemove', onInd8Move);
  1207. c.addEventListener('mouseup', onInd8Up);
  1208. c.addEventListener('mouseleave', onInd8Up);
  1209. c.addEventListener('touchstart', onInd8Down, { passive: false });
  1210. c.addEventListener('touchmove', onInd8Move, { passive: false });
  1211. c.addEventListener('touchend', onInd8Up);
  1212. c.addEventListener('touchcancel', onInd8Up);
  1213. ['indCurrent', 'indFreq'].forEach(id => {
  1214. document.getElementById(id).addEventListener('input', updateInductive);
  1215. });
  1216. document.getElementById('indDist').addEventListener('input', function() {
  1217. applyInd8DistSlider();
  1218. updateInductive();
  1219. });
  1220. document.getElementById('indArea').addEventListener('input', function() {
  1221. applyInd8AreaSlider();
  1222. updateInductive();
  1223. });
  1224. applyInd8AreaSlider();
  1225. applyInd8DistSlider();
  1226. ind8.lastT = performance.now();
  1227. requestAnimationFrame(drawInd8);
  1228. }
  1229. }
  1230. function getInd8Coords(e) {
  1231. const c = ind8.canvas;
  1232. const rect = c.getBoundingClientRect();
  1233. const sx = c.width / rect.width;
  1234. const sy = c.height / rect.height;
  1235. let cx, cy;
  1236. if (e.touches && e.touches.length) {
  1237. cx = e.touches[0].clientX;
  1238. cy = e.touches[0].clientY;
  1239. } else {
  1240. cx = e.clientX;
  1241. cy = e.clientY;
  1242. }
  1243. return { x: (cx - rect.left) * sx, y: (cy - rect.top) * sy };
  1244. }
  1245. function onInd8Down(e) {
  1246. e.preventDefault();
  1247. const p = getInd8Coords(e);
  1248. const l = ind8.loop;
  1249. const corners = [
  1250. { name: 'tl', x: l.x1, y: l.y1 },
  1251. { name: 'tr', x: l.x1 + l.w, y: l.y1 },
  1252. { name: 'bl', x: l.x1, y: l.y1 + l.h },
  1253. { name: 'br', x: l.x1 + l.w, y: l.y1 + l.h }
  1254. ];
  1255. for (const corner of corners) {
  1256. if (Math.hypot(p.x - corner.x, p.y - corner.y) < 18) {
  1257. ind8.dragMode = corner.name;
  1258. return;
  1259. }
  1260. }
  1261. const wire = ind8.wire;
  1262. const wireLeft = wire.x - wire.w/2 - 8;
  1263. const wireRight = wire.x + wire.w/2 + 8;
  1264. const wireTop = wire.cy - wire.h/2;
  1265. const wireBottom = wire.cy + wire.h/2;
  1266. if (p.x >= wireLeft && p.x <= wireRight && p.y >= wireTop && p.y <= wireBottom) {
  1267. ind8.dragMode = 'wire';
  1268. ind8.dragOffset = { x: p.x - wire.x, y: 0 };
  1269. ind8.canvas.style.cursor = 'grabbing';
  1270. return;
  1271. }
  1272. }
  1273. function onInd8Move(e) {
  1274. const p = getInd8Coords(e);
  1275. if (!ind8.dragMode) {
  1276. const l = ind8.loop;
  1277. const corners = [
  1278. [l.x1, l.y1], [l.x1 + l.w, l.y1],
  1279. [l.x1, l.y1 + l.h], [l.x1 + l.w, l.y1 + l.h]
  1280. ];
  1281. let overCorner = false;
  1282. for (const [cx, cy] of corners) {
  1283. if (Math.hypot(p.x - cx, p.y - cy) < 18) { overCorner = true; break; }
  1284. }
  1285. if (overCorner) {
  1286. ind8.canvas.style.cursor = 'nwse-resize';
  1287. } else if (Math.abs(p.x - ind8.wire.x) < 20 && p.y > 60 && p.y < 380) {
  1288. ind8.canvas.style.cursor = 'grab';
  1289. } else {
  1290. ind8.canvas.style.cursor = 'default';
  1291. }
  1292. return;
  1293. }
  1294. e.preventDefault();
  1295. if (ind8.dragMode === 'wire') {
  1296. let newX = p.x - ind8.dragOffset.x;
  1297. const loopLeft = ind8.loop.x1;
  1298. const minDistPx = 1 * ind8.pxPerCm;
  1299. const maxDistPx = 20 * ind8.pxPerCm;
  1300. const wireRightEdge = newX + ind8.wire.w / 2;
  1301. let distPx = loopLeft - wireRightEdge;
  1302. if (distPx < minDistPx) newX = loopLeft - minDistPx - ind8.wire.w / 2;
  1303. if (distPx > maxDistPx) newX = loopLeft - maxDistPx - ind8.wire.w / 2;
  1304. if (newX < 30) newX = 30;
  1305. ind8.wire.x = newX;
  1306. const d = Math.max(1, Math.min(20, Math.round((loopLeft - (newX + ind8.wire.w / 2)) / ind8.pxPerCm)));
  1307. const slider = document.getElementById('indDist');
  1308. slider.value = d;
  1309. document.getElementById('indDistVal').textContent = d;
  1310. return;
  1311. }
  1312. const l = ind8.loop;
  1313. let x1 = l.x1, y1 = l.y1, x2 = l.x1 + l.w, y2 = l.y1 + l.h;
  1314. if (ind8.dragMode === 'tl') { x1 = p.x; y1 = p.y; }
  1315. if (ind8.dragMode === 'tr') { x2 = p.x; y1 = p.y; }
  1316. if (ind8.dragMode === 'bl') { x1 = p.x; y2 = p.y; }
  1317. if (ind8.dragMode === 'br') { x2 = p.x; y2 = p.y; }
  1318. const minW = 50, minH = 50, maxW = 220, maxH = 260;
  1319. if (x2 - x1 < minW) {
  1320. if (ind8.dragMode === 'tl' || ind8.dragMode === 'bl') x1 = x2 - minW;
  1321. else x2 = x1 + minW;
  1322. }
  1323. if (x2 - x1 > maxW) {
  1324. if (ind8.dragMode === 'tl' || ind8.dragMode === 'bl') x1 = x2 - maxW;
  1325. else x2 = x1 + maxW;
  1326. }
  1327. if (y2 - y1 < minH) {
  1328. if (ind8.dragMode === 'tl' || ind8.dragMode === 'tr') y1 = y2 - minH;
  1329. else y2 = y1 + minH;
  1330. }
  1331. if (y2 - y1 > maxH) {
  1332. if (ind8.dragMode === 'tl' || ind8.dragMode === 'tr') y1 = y2 - maxH;
  1333. else y2 = y1 + maxH;
  1334. }
  1335. if (x1 < 20) x1 = 20;
  1336. if (y1 < 20) y1 = 20;
  1337. if (x2 > 780) x2 = 780;
  1338. if (y2 > 420) y2 = 420;
  1339. // Ограничение по расстоянию
  1340. const wireRightEdge = ind8.wire.x + ind8.wire.w / 2;
  1341. if (x1 < wireRightEdge + 1 * ind8.pxPerCm) {
  1342. const shift = (wireRightEdge + 1 * ind8.pxPerCm) - x1;
  1343. x1 += shift; x2 += shift;
  1344. if (ind8.dragMode === 'tl' || ind8.dragMode === 'bl') {
  1345. x1 = wireRightEdge + 1 * ind8.pxPerCm;
  1346. }
  1347. }
  1348. l.x1 = x1;
  1349. l.y1 = y1;
  1350. l.w = x2 - x1;
  1351. l.h = y2 - y1;
  1352. // Синхронизация слайдеров
  1353. const areaCm2 = Math.round((l.w * l.h) / 250);
  1354. document.getElementById('indArea').value = Math.max(0, Math.min(100, areaCm2));
  1355. document.getElementById('indAreaVal').textContent = Math.max(0, Math.min(100, areaCm2));
  1356. const distPx = l.x1 - wireRightEdge;
  1357. const distCm = Math.round(distPx / ind8.pxPerCm);
  1358. document.getElementById('indDist').value = Math.max(1, Math.min(20, distCm));
  1359. document.getElementById('indDistVal').textContent = Math.max(1, Math.min(20, distCm));
  1360. }
  1361. function onInd8Up() {
  1362. if (ind8.dragMode) {
  1363. ind8.dragMode = null;
  1364. ind8.canvas.style.cursor = 'default';
  1365. }
  1366. }
  1367. function applyInd8DistSlider() {
  1368. const d = parseFloat(document.getElementById('indDist').value);
  1369. ind8.wire.x = ind8.loop.x1 - d * ind8.pxPerCm - ind8.wire.w / 2;
  1370. if (ind8.wire.x < 30) ind8.wire.x = 30;
  1371. }
  1372. function applyInd8AreaSlider() {
  1373. const S = parseFloat(document.getElementById('indArea').value);
  1374. const targetArea = Math.max(2500, S * 250);
  1375. const aspect = ind8.loop.w / ind8.loop.h || 1;
  1376. let newH = Math.sqrt(targetArea / aspect);
  1377. let newW = newH * aspect;
  1378. if (newW < 50) { newW = 50; newH = targetArea / 50; }
  1379. if (newH < 50) { newH = 50; newW = targetArea / 50; }
  1380. if (newW > 220) { newW = 220; newH = targetArea / 220; }
  1381. if (newH > 260) { newH = 260; newW = targetArea / 260; }
  1382. ind8.loop.w = newW;
  1383. ind8.loop.h = newH;
  1384. }
  1385. function updateInductive() {
  1386. document.getElementById('indCurrentVal').textContent = document.getElementById('indCurrent').value;
  1387. document.getElementById('indFreqVal').textContent = document.getElementById('indFreq').value;
  1388. document.getElementById('indDistVal').textContent = document.getElementById('indDist').value;
  1389. document.getElementById('indAreaVal').textContent = document.getElementById('indArea').value;
  1390. }
  1391. function drawInd8() {
  1392. const sceneEl = document.querySelector('.scene[data-scene="8"]');
  1393. if (!sceneEl || !sceneEl.classList.contains('active')) {
  1394. requestAnimationFrame(drawInd8);
  1395. return;
  1396. }
  1397. if (!ind8.ctx) { requestAnimationFrame(drawInd8); return; }
  1398. const now = performance.now();
  1399. let dt = (now - ind8.lastT) / 1000;
  1400. ind8.lastT = now;
  1401. if (dt > 0.15) dt = 0.15;
  1402. if (dt < 0) dt = 0;
  1403. const I = parseFloat(document.getElementById('indCurrent').value);
  1404. const f = parseFloat(document.getElementById('indFreq').value);
  1405. const apparentF = f / 200;
  1406. if (f > 1) {
  1407. ind8.phase += 2 * Math.PI * apparentF * dt;
  1408. }
  1409. const B = I * Math.cos(ind8.phase);
  1410. const Babs = Math.min(1, Math.abs(B) / 10);
  1411. const ctx = ind8.ctx;
  1412. const cw = ind8.canvas.width;
  1413. const ch = ind8.canvas.height;
  1414. ctx.fillStyle = '#f2e9d6';
  1415. ctx.fillRect(0, 0, cw, ch);
  1416. const l = ind8.loop;
  1417. const lx1 = l.x1;
  1418. const ly1 = l.y1;
  1419. const lx2 = l.x1 + l.w;
  1420. const ly2 = l.y1 + l.h;
  1421. const wireRight = ind8.wire.x + ind8.wire.w / 2;
  1422. const distPx = Math.max(1, lx1 - wireRight);
  1423. const distCm = distPx / ind8.pxPerCm;
  1424. const areaCm2 = (l.w * l.h) / 250;
  1425. drawInd8Field(ctx, I, Babs, ind8.wire.x, ind8.wire.cy);
  1426. drawInd8Wire(ctx, ind8.wire, B);
  1427. drawInd8Loop(ctx, lx1, ly1, lx2, ly2);
  1428. drawInd8Distance(ctx, wireRight, lx1, (ly1 + ly2) / 2, distCm);
  1429. let emfInst = 0;
  1430. if (f > 1 && I > 0 && areaCm2 > 0) {
  1431. emfInst = 0.02 * I * areaCm2 * apparentF * Math.sin(ind8.phase) / Math.max(1, distCm);
  1432. }
  1433. drawInd8EmfArrow(ctx, lx1, ly1, lx2, ly2, emfInst);
  1434. ctx.fillStyle = '#4a5a7a';
  1435. ctx.font = '11px "Roboto Mono", monospace';
  1436. ctx.textAlign = 'left';
  1437. ctx.textBaseline = 'alphabetic';
  1438. ctx.fillText('S = ' + areaCm2.toFixed(0) + ' см²', lx1 + 4, ly1 - 24);
  1439. const emfEl = document.getElementById('indResult');
  1440. if (emfEl) emfEl.textContent = emfInst.toFixed(1);
  1441. const fbEl = document.getElementById('indFeedback');
  1442. if (fbEl) {
  1443. let msg = '';
  1444. if (I === 0) {
  1445. msg = 'Ток = 0 → магнитного поля нет → ЭДС = 0.';
  1446. } else if (f <= 1) {
  1447. msg = 'Частота = 0 (постоянный ток) → поле не меняется → ЭДС = 0. Ключевое отличие от гальванической наводки: постоянный ток здесь не работает.';
  1448. } else if (areaCm2 < 15) {
  1449. msg = 'Площадь петли маленькая → поток захватывается слабо.';
  1450. } else {
  1451. const parts = [];
  1452. if (I >= 7) parts.push('ток большой → поле сильное');
  1453. if (f >= 700) parts.push('частота высокая → поле меняется быстро');
  1454. if (areaCm2 >= 70) parts.push('площадь большая → поток велик');
  1455. if (distCm <= 5) parts.push('расстояние маленькое → поле не ослабло');
  1456. if (parts.length === 0) parts.push('значения в среднем диапазоне');
  1457. msg = 'Амплитуда ЭДС: ' + parts.join(', ') + '.';
  1458. }
  1459. fbEl.textContent = msg;
  1460. }
  1461. requestAnimationFrame(drawInd8);
  1462. }
  1463. function drawInd8Field(ctx, I, Babs, cx, cy) {
  1464. if (I <= 0) return;
  1465. const numLines = Math.max(1, Math.round(I * 1.4));
  1466. const alpha = 0.08 + Babs * 0.85;
  1467. const lw = 0.8 + Babs * 2.5;
  1468. for (let i = 1; i <= numLines; i++) {
  1469. const r = 30 + (i / numLines) * 260;
  1470. const rx = r * 0.7;
  1471. const ry = r;
  1472. if (Babs > 0.4) {
  1473. ctx.shadowColor = `rgba(255,140,50,${Babs * 0.55})`;
  1474. ctx.shadowBlur = 6 + Babs * 10;
  1475. }
  1476. ctx.strokeStyle = `rgba(139,26,26,${alpha})`;
  1477. ctx.lineWidth = lw;
  1478. ctx.beginPath();
  1479. ctx.ellipse(cx, cy, rx, ry, 0, 0, Math.PI * 2);
  1480. ctx.stroke();
  1481. ctx.shadowBlur = 0;
  1482. ctx.shadowColor = 'transparent';
  1483. }
  1484. }
  1485. function drawInd8Wire(ctx, wire, B) {
  1486. const x = wire.x;
  1487. const w = wire.w;
  1488. const y = wire.cy - wire.h / 2;
  1489. const h = wire.h;
  1490. ctx.fillStyle = 'rgba(0,0,0,0.15)';
  1491. ctx.fillRect(x - w/2 + 3, y + 3, w, h);
  1492. ctx.fillStyle = '#8b1a1a';
  1493. ctx.fillRect(x - w/2, y, w, h);
  1494. ctx.strokeStyle = '#1a2a4a';
  1495. ctx.lineWidth = 2;
  1496. ctx.strokeRect(x - w/2, y, w, h);
  1497. const dir = B >= 0 ? -1 : 1;
  1498. const numArrows = 5;
  1499. const arrowY0 = y + 40;
  1500. const arrowStep = (h - 80) / (numArrows - 1);
  1501. ctx.fillStyle = 'rgba(255,255,255,0.9)';
  1502. for (let i = 0; i < numArrows; i++) {
  1503. const ay = arrowY0 + i * arrowStep;
  1504. const tip = ay + 8 * dir;
  1505. ctx.beginPath();
  1506. ctx.moveTo(x, tip);
  1507. ctx.lineTo(x - 6, ay);
  1508. ctx.lineTo(x + 6, ay);
  1509. ctx.closePath();
  1510. ctx.fill();
  1511. }
  1512. ctx.fillStyle = '#8b1a1a';
  1513. ctx.font = 'bold 14px "Roboto Mono", monospace';
  1514. ctx.textAlign = 'center';
  1515. ctx.textBaseline = 'alphabetic';
  1516. ctx.fillText('I', x, y - 12);
  1517. ctx.fillStyle = '#4a5a7a';
  1518. ctx.font = '11px "Roboto Mono", monospace';
  1519. ctx.fillText('источник', x, y + h + 20);
  1520. }
  1521. function drawInd8Loop(ctx, x1, y1, x2, y2) {
  1522. ctx.fillStyle = 'rgba(42,90,42,0.04)';
  1523. ctx.fillRect(x1, y1, x2 - x1, y2 - y1);
  1524. ctx.strokeStyle = '#2a5a2a';
  1525. ctx.lineWidth = 4;
  1526. ctx.strokeRect(x1, y1, x2 - x1, y2 - y1);
  1527. const corners = [[x1,y1],[x2,y1],[x1,y2],[x2,y2]];
  1528. corners.forEach(([cx,cy]) => {
  1529. ctx.fillStyle = '#2a5a2a';
  1530. ctx.beginPath();
  1531. ctx.arc(cx, cy, 7, 0, Math.PI*2);
  1532. ctx.fill();
  1533. ctx.strokeStyle = '#fffef8';
  1534. ctx.lineWidth = 2;
  1535. ctx.stroke();
  1536. });
  1537. ctx.fillStyle = '#2a5a2a';
  1538. ctx.font = '11px "Roboto Mono", monospace';
  1539. ctx.textAlign = 'center';
  1540. ctx.textBaseline = 'alphabetic';
  1541. ctx.fillText('петля', (x1+x2)/2, y2 + 20);
  1542. }
  1543. function drawInd8Distance(ctx, x1, x2, y, distCm) {
  1544. ctx.strokeStyle = 'rgba(74,90,122,0.55)';
  1545. ctx.lineWidth = 1;
  1546. ctx.setLineDash([4, 4]);
  1547. ctx.beginPath();
  1548. ctx.moveTo(x1 + 4, y);
  1549. ctx.lineTo(x2 - 4, y);
  1550. ctx.stroke();
  1551. ctx.setLineDash([]);
  1552. ctx.fillStyle = 'rgba(74,90,122,0.85)';
  1553. ctx.beginPath();
  1554. ctx.moveTo(x1 + 4, y);
  1555. ctx.lineTo(x1 + 14, y - 5);
  1556. ctx.lineTo(x1 + 14, y + 5);
  1557. ctx.closePath();
  1558. ctx.fill();
  1559. ctx.beginPath();
  1560. ctx.moveTo(x2 - 4, y);
  1561. ctx.lineTo(x2 - 14, y - 5);
  1562. ctx.lineTo(x2 - 14, y + 5);
  1563. ctx.closePath();
  1564. ctx.fill();
  1565. ctx.fillStyle = '#1a2a4a';
  1566. ctx.font = 'bold 12px "Roboto Mono", monospace';
  1567. ctx.textAlign = 'center';
  1568. ctx.textBaseline = 'bottom';
  1569. ctx.fillText('d = ' + distCm.toFixed(1) + ' см', (x1 + x2) / 2, y - 6);
  1570. }
  1571. function drawInd8EmfArrow(ctx, x1, y1, x2, y2, emf) {
  1572. const maxEmf = 30;
  1573. const ratio = Math.min(1, Math.abs(emf) / maxEmf);
  1574. if (ratio < 0.03) return;
  1575. const cx = (x1 + x2) / 2;
  1576. const cy = (y1 + y2) / 2;
  1577. const r = Math.min(x2 - x1, y2 - y1) * 0.28;
  1578. if (r < 8) return;
  1579. const alpha = 0.35 + ratio * 0.6;
  1580. const clockwise = emf >= 0;
  1581. const lw = 2 + ratio * 3;
  1582. const A = -Math.PI * 0.85;
  1583. const B = Math.PI * 0.55;
  1584. ctx.save();
  1585. ctx.translate(cx, cy);
  1586. ctx.strokeStyle = `rgba(139,26,26,${alpha})`;
  1587. ctx.lineWidth = lw;
  1588. ctx.lineCap = 'round';
  1589. let hx, hy, tang;
  1590. if (clockwise) {
  1591. ctx.beginPath();
  1592. ctx.arc(0, 0, r, A, B, false);
  1593. ctx.stroke();
  1594. hx = Math.cos(B) * r;
  1595. hy = Math.sin(B) * r;
  1596. tang = B + Math.PI / 2;
  1597. } else {
  1598. ctx.beginPath();
  1599. ctx.arc(0, 0, r, B, A, true);
  1600. ctx.stroke();
  1601. hx = Math.cos(A) * r;
  1602. hy = Math.sin(A) * r;
  1603. tang = A - Math.PI / 2;
  1604. }
  1605. const size = 6 + ratio * 6;
  1606. const tipX = hx + Math.cos(tang) * size;
  1607. const tipY = hy + Math.sin(tang) * size;
  1608. const perpX = Math.cos(tang + Math.PI / 2);
  1609. const perpY = Math.sin(tang + Math.PI / 2);
  1610. const baseX1 = hx + perpX * size * 0.6;
  1611. const baseY1 = hy + perpY * size * 0.6;
  1612. const baseX2 = hx - perpX * size * 0.6;
  1613. const baseY2 = hy - perpY * size * 0.6;
  1614. ctx.beginPath();
  1615. ctx.moveTo(tipX, tipY);
  1616. ctx.lineTo(baseX1, baseY1);
  1617. ctx.lineTo(baseX2, baseY2);
  1618. ctx.closePath();
  1619. ctx.fillStyle = `rgba(139,26,26,${alpha})`;
  1620. ctx.fill();
  1621. ctx.restore();
  1622. ctx.lineCap = 'butt';
  1623. ctx.fillStyle = '#8b1a1a';
  1624. ctx.font = 'bold 12px "Roboto Mono", monospace';
  1625. ctx.textAlign = 'center';
  1626. ctx.textBaseline = 'middle';
  1627. const sign = emf >= 0 ? '+' : '−';
  1628. ctx.fillText(sign + Math.abs(emf).toFixed(1) + ' мВ', cx, cy + r + 18);
  1629. }
  1630. function drawCapacitive() {
  1631. const canvas = document.getElementById('capacitiveViz');
  1632. const ctx = canvas.getContext('2d');
  1633. function render() {
  1634. const w = canvas.width, h = canvas.height;
  1635. ctx.fillStyle = '#f2e9d6';
  1636. ctx.fillRect(0, 0, w, h);
  1637. ctx.fillStyle = '#1a4a6a';
  1638. ctx.fillRect(80, 30, 14, h - 60);
  1639. ctx.fillStyle = '#1a4a6a';
  1640. ctx.font = 'bold 12px monospace';
  1641. ctx.textAlign = 'center';
  1642. ctx.fillText('U', 87, 20);
  1643. const U = parseFloat(document.getElementById('capVolt').value);
  1644. const lineCount = Math.max(1, Math.floor(U / 100));
  1645. ctx.strokeStyle = 'rgba(26,74,106,0.35)';
  1646. ctx.lineWidth = 1.5;
  1647. for (let i = 0; i < lineCount; i++) {
  1648. const y = 40 + i * (h - 80) / Math.max(1, lineCount - 1);
  1649. ctx.beginPath();
  1650. ctx.moveTo(94, y);
  1651. ctx.lineTo(520, y);
  1652. ctx.stroke();
  1653. }
  1654. ctx.fillStyle = '#2a5a2a';
  1655. ctx.fillRect(520, 40, 14, h - 80);
  1656. ctx.fillStyle = '#2a5a2a';
  1657. ctx.fillText('приёмник', 527, h - 20);
  1658. const cap = calcCapacitive();
  1659. if (cap > 0.1) {
  1660. const charges = Math.min(8, Math.floor(cap / 10));
  1661. for (let i = 0; i < charges; i++) {
  1662. ctx.fillStyle = '#8b1a1a';
  1663. ctx.beginPath();
  1664. ctx.arc(545, 50 + i * 20, 3, 0, Math.PI*2);
  1665. ctx.fill();
  1666. }
  1667. }
  1668. requestAnimationFrame(render);
  1669. }
  1670. render();
  1671. }
  1672. function calcCapacitive() {
  1673. const U = parseFloat(document.getElementById('capVolt').value);
  1674. const f = parseFloat(document.getElementById('capFreq').value);
  1675. const d = parseFloat(document.getElementById('capDist').value);
  1676. const S = parseFloat(document.getElementById('capArea').value);
  1677. if (U === 0 || f === 0 || S === 0 || d === 0) return 0;
  1678. const base = (U / 1000) * (f / 1000) * (S / 100) * (1 / d) * 100;
  1679. return Math.min(base, 99.9);
  1680. }
  1681. function updateCapacitive() {
  1682. document.getElementById('capVoltVal').textContent = document.getElementById('capVolt').value;
  1683. document.getElementById('capFreqVal').textContent = document.getElementById('capFreq').value;
  1684. document.getElementById('capDistVal').textContent = document.getElementById('capDist').value;
  1685. document.getElementById('capAreaVal').textContent = document.getElementById('capArea').value;
  1686. const val = calcCapacitive();
  1687. document.getElementById('capResult').textContent = val.toFixed(1);
  1688. const U = parseFloat(document.getElementById('capVolt').value);
  1689. const f = parseFloat(document.getElementById('capFreq').value);
  1690. const d = parseFloat(document.getElementById('capDist').value);
  1691. const S = parseFloat(document.getElementById('capArea').value);
  1692. let msg = '';
  1693. if (U === 0) msg = 'Напряжение = 0 → электрического поля нет → наводки нет.';
  1694. else if (f === 0) msg = 'Частота = 0 (постоянное напряжение) → заряд не меняется → наводки нет.';
  1695. else if (S === 0) msg = 'Площадь = 0 → ёмкость связи нулевая → наводки нет.';
  1696. else {
  1697. const parts = [];
  1698. if (U >= 700) parts.push('напряжение большое → заряд на пластинах велик');
  1699. if (f >= 700) parts.push('частота высокая → ток смещения больше');
  1700. if (S >= 70) parts.push('площадь большая → ёмкость больше');
  1701. if (d <= 5) parts.push('расстояние маленькое → ёмкость не ослабла');
  1702. if (parts.length === 0) parts.push('значения в среднем диапазоне');
  1703. msg = 'Наводка: ' + parts.join(', ') + '.';
  1704. }
  1705. document.getElementById('capFeedback').textContent = msg;
  1706. }
  1707. ['capVolt', 'capFreq', 'capDist', 'capArea'].forEach(id => {
  1708. document.getElementById(id).addEventListener('input', updateCapacitive);
  1709. });
  1710. function drawGalvanic() {
  1711. const canvas = document.getElementById('galvanicViz');
  1712. const ctx = canvas.getContext('2d');
  1713. function render() {
  1714. const w = canvas.width, h = canvas.height;
  1715. ctx.fillStyle = '#f2e9d6';
  1716. ctx.fillRect(0, 0, w, h);
  1717. const I = parseFloat(document.getElementById('galCurrent').value);
  1718. const R = parseFloat(document.getElementById('galRes').value);
  1719. ctx.strokeStyle = '#1a2a4a';
  1720. ctx.lineWidth = 4;
  1721. ctx.beginPath();
  1722. ctx.moveTo(80, h - 50);
  1723. ctx.lineTo(w - 80, h - 50);
  1724. ctx.stroke();
  1725. ctx.fillStyle = '#8b1a1a';
  1726. ctx.fillRect(120, 60, 100, 50);
  1727. ctx.fillStyle = '#fff';
  1728. ctx.font = 'bold 12px monospace';
  1729. ctx.textAlign = 'center';
  1730. ctx.fillText('нагрузка', 170, 80);
  1731. ctx.fillText('I = ' + I + ' А', 170, 98);
  1732. ctx.fillStyle = '#2a5a2a';
  1733. ctx.fillRect(480, 60, 100, 50);
  1734. ctx.fillStyle = '#fff';
  1735. ctx.fillText('сигнал', 530, 80);
  1736. ctx.fillText('U_помехи', 530, 98);
  1737. ctx.strokeStyle = '#8b1a1a';
  1738. ctx.lineWidth = 2;
  1739. ctx.beginPath();
  1740. ctx.moveTo(170, 110); ctx.lineTo(170, h - 50);
  1741. ctx.stroke();
  1742. ctx.beginPath();
  1743. ctx.moveTo(530, 110); ctx.lineTo(530, h - 50);
  1744. ctx.stroke();
  1745. const rWidth = 20 + R * 40;
  1746. ctx.fillStyle = '#8b1a1a';
  1747. ctx.fillRect(330 - rWidth/2, h - 55, rWidth, 10);
  1748. ctx.fillStyle = '#1a2a4a';
  1749. ctx.font = '11px monospace';
  1750. ctx.fillText('R = ' + R.toFixed(2) + ' Ом', 330, h - 70);
  1751. const drop = I * R;
  1752. ctx.fillStyle = '#8b1a1a';
  1753. ctx.font = 'bold 14px monospace';
  1754. ctx.fillText('U = I·R = ' + drop.toFixed(2) + ' В', 330, h - 85);
  1755. ctx.fillStyle = '#1a2a4a';
  1756. ctx.fillRect(w - 120, h - 65, 40, 30);
  1757. ctx.fillStyle = '#fff';
  1758. ctx.font = '10px monospace';
  1759. ctx.fillText('земля', w - 100, h - 47);
  1760. requestAnimationFrame(render);
  1761. }
  1762. render();
  1763. }
  1764. function calcGalvanic() {
  1765. const I = parseFloat(document.getElementById('galCurrent').value);
  1766. const R = parseFloat(document.getElementById('galRes').value);
  1767. const G = parseFloat(document.getElementById('galGround').value);
  1768. if (I === 0 || R === 0) return 0;
  1769. const effR = R * (1 + (100 - G) / 100);
  1770. const base = I * effR * 10;
  1771. return Math.min(base, 99.9);
  1772. }
  1773. function updateGalvanic() {
  1774. document.getElementById('galCurrentVal').textContent = document.getElementById('galCurrent').value;
  1775. document.getElementById('galResVal').textContent = parseFloat(document.getElementById('galRes').value).toFixed(2);
  1776. document.getElementById('galGroundVal').textContent = document.getElementById('galGround').value;
  1777. const val = calcGalvanic();
  1778. document.getElementById('galResult').textContent = val.toFixed(1);
  1779. const I = parseFloat(document.getElementById('galCurrent').value);
  1780. const R = parseFloat(document.getElementById('galRes').value);
  1781. const G = parseFloat(document.getElementById('galGround').value);
  1782. let msg = '';
  1783. if (I === 0) msg = 'Ток = 0 → падения напряжения нет → помехи нет.';
  1784. else if (R === 0) msg = 'Сопротивление общего участка = 0 → падения нет → помехи нет (идеальная земля).';
  1785. else {
  1786. const parts = [];
  1787. if (I >= 7) parts.push('ток большой → падение больше');
  1788. if (R >= 0.7) parts.push('сопротивление большое → падение больше');
  1789. if (G <= 30) parts.push('заземление плохое → эффективное сопротивление растёт');
  1790. if (parts.length === 0) parts.push('значения в среднем диапазоне');
  1791. msg = 'По закону Ома U = I·R: ' + parts.join(', ') + '.';
  1792. }
  1793. document.getElementById('galFeedback').textContent = msg;
  1794. }
  1795. ['galCurrent', 'galRes', 'galGround'].forEach(id => {
  1796. document.getElementById(id).addEventListener('input', updateGalvanic);
  1797. });
  1798. const quizData = [
  1799. { q: 'Что является средой в электромагнитном канале?',
  1800. options: ['Только воздух', 'Электрическое или магнитное поле, либо общий проводник', 'Только вакуум'],
  1801. correct: 1,
  1802. explain: 'В электромагнитном канале средой может быть электрическое поле (ёмкостная связь), магнитное поле (индуктивная) или общий проводник (гальваническая). Воздух — лишь одна из возможных сред, но не единственная.' },
  1803. { q: 'От чего зависит индуктивная наводка?',
  1804. options: ['От напряжения и сопротивления', 'От тока, частоты, площади петли и расстояния', 'Только от расстояния'],
  1805. correct: 1,
  1806. explain: 'Индуктивная наводка возникает из-за изменения магнитного потока. Поток зависит от тока, частоты, площади петли и расстояния. Напряжение здесь ни при чём — это ёмкостная наводка.' },
  1807. { q: 'От чего зависит ёмкостная наводка?',
  1808. options: ['От тока и сопротивления', 'От напряжения, частоты, площади и расстояния', 'Только от тока'],
  1809. correct: 1,
  1810. explain: 'Ёмкостная наводка — это наведение через электрическое поле. Оно зависит от напряжения, частоты, площади и расстояния. Ток — это про магнитное поле, не про электрическое.' },
  1811. { q: 'От чего зависит гальваническая наводка?',
  1812. options: ['От тока, сопротивления общего участка и качества заземления', 'От напряжения и площади', 'Только от частоты'],
  1813. correct: 0,
  1814. explain: 'Гальваническая наводка — это падение напряжения на общем сопротивлении по закону Ома: U = I·R. Плохое заземление увеличивает эффективное сопротивление, поэтому помеха растёт.' },
  1815. { q: 'Даёт ли постоянный ток индуктивную наводку?',
  1816. options: ['Да, всегда', 'Нет, потому что магнитный поток не меняется', 'Только при большом токе'],
  1817. correct: 1,
  1818. explain: 'Индуктивная наводка возникает только при изменении магнитного потока (закон Фарадея: ЭДС = −dФ/dt). При постоянном токе поток постоянен, значит, ЭДС = 0. Это ключевое отличие от гальванической наводки, где постоянный ток как раз работает.' },
  1819. { q: 'Экран от какого механизма помогает хуже всего?',
  1820. options: ['От ёмкостного', 'От индуктивного', 'От гальванического'],
  1821. correct: 2,
  1822. explain: 'Электростатический экран хорошо работает от ёмкостной наводки, частично — от индуктивной (если магнитный материал). От гальванической он почти бесполезен: помеха идёт по общему проводнику, и экран её не разрывает. Нужен разрыв цепи (оптрон, трансформатор).' },
  1823. { q: 'Что общего у трёх механизмов наводок?',
  1824. options: ['Они все используют магнитное поле', 'Структура канала: источник → среда → приёмник', 'Они все подавляются одним и тем же экраном'],
  1825. correct: 1,
  1826. explain: 'Все три механизма — это один электромагнитный канал со структурой источник → среда → приёмник. Различается только физическая природа среды. Именно поэтому защита разная: один способ не работает одинаково против всех трёх.' }
  1827. ];
  1828. let quizInitialized = false;
  1829. function initQuiz() {
  1830. if (quizInitialized) return;
  1831. quizInitialized = true;
  1832. const container = document.getElementById('quizContainer');
  1833. let html = '';
  1834. quizData.forEach((item, i) => {
  1835. html += `<div class="question" id="q${i}">
  1836. <div class="q-num">Вопрос ${i+1} из ${quizData.length}</div>
  1837. <div class="q-text">${item.q}</div>`;
  1838. item.options.forEach((opt, j) => {
  1839. html += `<label><input type="radio" name="q${i}" value="${j}"> ${opt}</label>`;
  1840. });
  1841. html += `<div class="explain" id="explain${i}"></div>
  1842. <div class="result-mark" id="mark${i}"></div>
  1843. </div>`;
  1844. });
  1845. html += `<div style="text-align:center; margin-top:20px;">
  1846. <button id="checkQuiz" class="primary">Проверить ответы</button>
  1847. </div>`;
  1848. container.innerHTML = html;
  1849. document.getElementById('checkQuiz').addEventListener('click', checkQuiz);
  1850. }
  1851. function checkQuiz() {
  1852. let score = 0;
  1853. quizData.forEach((item, i) => {
  1854. const selected = document.querySelector(`input[name="q${i}"]:checked`);
  1855. const questionEl = document.getElementById('q' + i);
  1856. const explainEl = document.getElementById('explain' + i);
  1857. const markEl = document.getElementById('mark' + i);
  1858. questionEl.classList.remove('correct', 'incorrect');
  1859. explainEl.classList.remove('show');
  1860. markEl.textContent = '';
  1861. markEl.className = 'result-mark';
  1862. if (!selected) {
  1863. markEl.textContent = '— Нет ответа';
  1864. markEl.classList.add('bad');
  1865. explainEl.innerHTML = '<strong>Правильный ответ:</strong> ' + item.options[item.correct] + '. ' + item.explain;
  1866. explainEl.classList.add('show');
  1867. return;
  1868. }
  1869. const val = parseInt(selected.value);
  1870. if (val === item.correct) {
  1871. score++;
  1872. questionEl.classList.add('correct');
  1873. markEl.textContent = '✓ Верно';
  1874. markEl.classList.add('ok');
  1875. explainEl.innerHTML = '<strong>Пояснение:</strong> ' + item.explain;
  1876. explainEl.classList.add('show');
  1877. } else {
  1878. questionEl.classList.add('incorrect');
  1879. markEl.textContent = '✗ Неверно';
  1880. markEl.classList.add('bad');
  1881. explainEl.innerHTML = '<strong>Правильный ответ:</strong> ' + item.options[item.correct] + '. ' + item.explain;
  1882. explainEl.classList.add('show');
  1883. }
  1884. });
  1885. const resultEl = document.getElementById('quizResult');
  1886. const percent = Math.round((score / quizData.length) * 100);
  1887. let verdict = '';
  1888. if (score === quizData.length) verdict = 'Отлично. Материал усвоен.';
  1889. else if (score >= 5) verdict = 'Хорошо. Есть неточности, но основное понято.';
  1890. else if (score >= 3) verdict = 'Удовлетворительно. Повторите механизмы и их различия.';
  1891. else verdict = 'Неудовлетворительно. Вернитесь к сценам 8–10.';
  1892. resultEl.innerHTML = `
  1893. <div class="final-score">
  1894. <div class="num">${score}</div>
  1895. <div class="of">из ${quizData.length} (${percent}%)</div>
  1896. <div class="verdict">${verdict}</div>
  1897. </div>
  1898. `;
  1899. resultEl.style.display = 'block';
  1900. document.getElementById('finalChecklist').style.display = 'block';
  1901. resultEl.scrollIntoView({ behavior: 'smooth', block: 'center' });
  1902. }
  1903. showScene(0);
  1904. window.addEventListener('load', () => {
  1905. initFields();
  1906. drawWireB();
  1907. drawCapacitor();
  1908. drawInductor();
  1909. });
  1910. })();
  1911. </script>
  1912. </body>
  1913. </html>