mirror of
https://github.com/CasberryIndia/Physics-Notebook.git
synced 2026-12-03 20:48:14 +00:00
1866 lines
91 KiB
HTML
1866 lines
91 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
||
<!-- ─── Primary SEO ─────────────────────────────────────────────── -->
|
||
<title>Physics Notebook — Interactive Physics Simulations & Visualizations</title>
|
||
<meta name="description" content="Explore physics through beautiful interactive simulations. From Newton's Laws to Noether's Theorem — every concept brought to life with real-time canvas animations, equations, and AI-assisted learning.">
|
||
<meta name="keywords" content="physics simulations, interactive physics, classical mechanics, quantum mechanics, electromagnetism, special relativity, Noether's theorem, Newton's laws, pendulum, orbital mechanics, wave interference, physics notebook, physics learning">
|
||
<meta name="author" content="Physics Notebook Community">
|
||
<link rel="canonical" href="https://physics-notebook.casberry.in/">
|
||
|
||
<!-- ─── Open Graph (Facebook, LinkedIn, Discord, Slack, etc.) ───── -->
|
||
<meta property="og:type" content="website">
|
||
<meta property="og:site_name" content="Physics Notebook">
|
||
<meta property="og:title" content="Physics Notebook — Interactive Physics Simulations">
|
||
<meta property="og:description" content="Explore physics through beautiful interactive simulations. From Newton's Laws to Noether's Theorem — every concept brought to life with real-time canvas animations and AI-assisted learning.">
|
||
<meta property="og:url" content="https://physics-notebook.casberry.in/">
|
||
<meta property="og:image" content="https://physics-notebook.casberry.in/assets/og-image.jpg">
|
||
<meta property="og:image:type" content="image/jpeg">
|
||
<meta property="og:image:width" content="1200">
|
||
<meta property="og:image:height" content="628">
|
||
<meta property="og:image:alt" content="Physics Notebook — Interactive simulations for every physics concept">
|
||
<meta property="og:locale" content="en_US">
|
||
|
||
<!-- ─── Twitter / X Card ────────────────────────────────────────── -->
|
||
<meta name="twitter:card" content="summary_large_image">
|
||
<meta name="twitter:domain" content="physics-notebook.casberry.in">
|
||
<meta name="twitter:title" content="Physics Notebook — Interactive Physics Simulations">
|
||
<meta name="twitter:description" content="Explore physics through beautiful interactive simulations. From Newton's Laws to Noether's Theorem — every concept brought to life.">
|
||
<meta name="twitter:image" content="https://physics-notebook.casberry.in/assets/og-image.jpg">
|
||
<meta name="twitter:image:alt" content="Physics Notebook — Interactive simulations for every physics concept">
|
||
|
||
<!-- ─── Favicon ─────────────────────────────────────────────────── -->
|
||
<link rel="icon" type="image/svg+xml" href="assets/icons/favicon.svg">
|
||
<link rel="icon" type="image/png" sizes="32x32" href="assets/icons/favicon-32.png">
|
||
<link rel="apple-touch-icon" sizes="180x180" href="assets/icons/apple-touch-icon.png">
|
||
|
||
<!-- ─── JSON-LD Structured Data ─────────────────────────────────── -->
|
||
<script type="application/ld+json">
|
||
{
|
||
"@context": "https://schema.org",
|
||
"@type": "WebSite",
|
||
"name": "Physics Notebook",
|
||
"description": "An open-source interactive physics learning platform with real-time simulations, mathematical equations, and AI-assisted exploration.",
|
||
"url": "https://physics-notebook.casberry.in/",
|
||
"image": "https://physics-notebook.casberry.in/assets/og-image.png",
|
||
"inLanguage": "en-US",
|
||
"license": "https://opensource.org/licenses/MIT",
|
||
"sameAs": [
|
||
"https://github.com/CasberryIndia/Physics-Notebook"
|
||
],
|
||
"potentialAction": {
|
||
"@type": "SearchAction",
|
||
"target": {
|
||
"@type": "EntryPoint",
|
||
"urlTemplate": "https://physics-notebook.casberry.in/?q={search_term_string}"
|
||
},
|
||
"query-input": "required name=search_term_string"
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<!-- ─── CSS ─────────────────────────────────────────────────────── -->
|
||
<link rel="stylesheet" href="css/common.css">
|
||
<link rel="stylesheet" href="css/home.css">
|
||
|
||
<!-- Theme Init (Blocking to prevent flash) -->
|
||
<script>
|
||
const savedTheme = localStorage.getItem('physics-notebook-theme') || 'light';
|
||
document.documentElement.setAttribute('data-theme', savedTheme);
|
||
document.body && document.body.setAttribute('data-theme', savedTheme); // Fallback
|
||
</script>
|
||
|
||
<!-- Libs -->
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js"></script>
|
||
<script src="https://unpkg.com/lucide@latest"></script>
|
||
</head>
|
||
|
||
|
||
<body>
|
||
|
||
<nav>
|
||
<div class="logo">
|
||
<i data-lucide="atom"></i>
|
||
Physics • Notebook
|
||
</div>
|
||
<div class="nav-controls">
|
||
<a href="https://github.com/CasberryIndia/Physics-Notebook" target="_blank" rel="noopener noreferrer" class="github-btn"
|
||
title="View Source on GitHub">
|
||
<svg fill="currentColor" width="16" height="16" viewBox="0 -0.5 25 25" style="display: inline-block; vertical-align: middle;" xmlns="http://www.w3.org/2000/svg"><path d="m12.301 0h.093c2.242 0 4.34.613 6.137 1.68l-.055-.031c1.871 1.094 3.386 2.609 4.449 4.422l.031.058c1.04 1.769 1.654 3.896 1.654 6.166 0 5.406-3.483 10-8.327 11.658l-.087.026c-.063.02-.135.031-.209.031-.162 0-.312-.054-.433-.144l.002.001c-.128-.115-.208-.281-.208-.466 0-.005 0-.01 0-.014v.001q0-.048.008-1.226t.008-2.154c.007-.075.011-.161.011-.249 0-.792-.323-1.508-.844-2.025.618-.061 1.176-.163 1.718-.305l-.076.017c.573-.16 1.073-.373 1.537-.642l-.031.017c.508-.28.938-.636 1.292-1.058l.006-.007c.372-.476.663-1.036.84-1.645l.009-.035c.209-.683.329-1.468.329-2.281 0-.045 0-.091-.001-.136v.007c0-.022.001-.047.001-.072 0-1.248-.482-2.383-1.269-3.23l.003.003c.168-.44.265-.948.265-1.479 0-.649-.145-1.263-.404-1.814l.011.026c-.115-.022-.246-.035-.381-.035-.334 0-.649.078-.929.216l.012-.005c-.568.21-1.054.448-1.512.726l.038-.022-.609.384c-.922-.264-1.981-.416-3.075-.416s-2.153.152-3.157.436l.081-.02q-.256-.176-.681-.433c-.373-.214-.814-.421-1.272-.595l-.066-.022c-.293-.154-.64-.244-1.009-.244-.124 0-.246.01-.364.03l.013-.002c-.248.524-.393 1.139-.393 1.788 0 .531.097 1.04.275 1.509l-.01-.029c-.785.844-1.266 1.979-1.266 3.227 0 .025 0 .051.001.076v-.004c-.001.039-.001.084-.001.13 0 .809.12 1.591.344 2.327l-.015-.057c.189.643.476 1.202.85 1.693l-.009-.013c.354.435.782.793 1.267 1.062l.022.011c.432.252.933.465 1.46.614l.046.011c.466.125 1.024.227 1.595.284l.046.004c-.431.428-.718 1-.784 1.638l-.001.012c-.207.101-.448.183-.699.236l-.021.004c-.256.051-.549.08-.85.08-.022 0-.044 0-.066 0h.003c-.394-.008-.756-.136-1.055-.348l.006.004c-.371-.259-.671-.595-.881-.986l-.007-.015c-.198-.336-.459-.614-.768-.827l-.009-.006c-.225-.169-.49-.301-.776-.38l-.016-.004-.32-.048c-.023-.002-.05-.003-.077-.003-.14 0-.273.028-.394.077l.007-.003q-.128.072-.08.184c.039.086.087.16.145.225l-.001-.001c.061.072.13.135.205.19l.003.002.112.08c.283.148.516.354.693.603l.004.006c.191.237.359.505.494.792l.01.024.16.368c.135.402.38.738.7.981l.005.004c.3.234.662.402 1.057.478l.016.002c.33.064.714.104 1.106.112h.007c.045.002.097.002.15.002.261 0 .517-.021.767-.062l-.027.004.368-.064q0 .609.008 1.418t.008.873v.014c0 .185-.08.351-.208.466h-.001c-.119.089-.268.143-.431.143-.075 0-.147-.011-.214-.032l.005.001c-4.929-1.689-8.409-6.283-8.409-11.69 0-2.268.612-4.393 1.681-6.219l-.032.058c1.094-1.871 2.609-3.386 4.422-4.449l.058-.031c1.739-1.034 3.835-1.645 6.073-1.645h.098-.005zm-7.64 17.666q.048-.112-.112-.192-.16-.048-.208.032-.048.112.112.192.144.096.208-.032zm.497.545q.112-.08-.032-.256-.16-.144-.256-.048-.112.08.032.256.159.157.256.047zm.48.72q.144-.112 0-.304-.128-.208-.272-.096-.144.08 0 .288t.272.112zm.672.673q.128-.128-.064-.304-.192-.192-.32-.048-.144.128.064.304.192.192.32.044zm.913.4q.048-.176-.208-.256-.24-.064-.304.112t.208.24q.24.097.304-.096zm1.009.08q0-.208-.272-.176-.256 0-.256.176 0 .208.272.176.256.001.256-.175zm.929-.16q-.032-.176-.288-.144-.256.048-.224.24t.288.128.225-.224z"/></svg>
|
||
<span id="starCount">...</span>
|
||
</a>
|
||
<button id="themeBtn">
|
||
<i data-lucide="moon" style="width:16px;"></i> Theme
|
||
</button>
|
||
</div>
|
||
</nav>
|
||
|
||
<div class="library-header">
|
||
<h1 class="hero-title">Interactive Library</h1>
|
||
|
||
<div class="controls-bar">
|
||
<!-- Search -->
|
||
<div class="search-container">
|
||
<i data-lucide="search" class="search-icon"></i>
|
||
<input type="text" id="searchInput" placeholder="Search topics (e.g., 'Gravity', 'Waves')...">
|
||
</div>
|
||
|
||
<!-- Filters -->
|
||
<div class="filter-group" id="filterContainer">
|
||
<button class="filter-chip active" data-filter="all">All Domains</button>
|
||
<button class="filter-chip" data-filter="Mechanics">Mechanics</button>
|
||
<button class="filter-chip" data-filter="Waves">Waves & Optics</button>
|
||
<button class="filter-chip" data-filter="Electromagnetism">Electromagnetism</button>
|
||
<button class="filter-chip" data-filter="Quantum">Quantum</button>
|
||
<button class="filter-chip view-all-domains-btn" id="viewAllDomainsBtn" aria-haspopup="dialog" aria-expanded="false">
|
||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="display:inline-block;vertical-align:middle;margin-right:5px;"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>
|
||
View All Domains
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Main Grid -->
|
||
<main class="grid-container" id="cardsGrid">
|
||
<!-- Cards Injected via JS -->
|
||
</main>
|
||
|
||
<footer class="main-footer">
|
||
<p>Want to add a concept? <a href="contribute.html">Contribute</a></p>
|
||
</footer>
|
||
|
||
<!-- ================================================================
|
||
DOMAINS OVERLAY
|
||
================================================================ -->
|
||
<div id="domainsOverlay" class="domains-overlay" role="dialog" aria-modal="true" aria-label="All Physics Domains" hidden>
|
||
<div class="domains-overlay-backdrop" id="domainsOverlayBackdrop"></div>
|
||
<div class="domains-overlay-panel">
|
||
|
||
<div class="domains-overlay-header">
|
||
<div>
|
||
<h2 class="domains-overlay-title">All Physics Domains</h2>
|
||
<p class="domains-overlay-subtitle">Browse every domain and concept — live pages are linked, upcoming ones are in the roadmap.</p>
|
||
</div>
|
||
<button class="domains-close-btn" id="domainsCloseBtn" aria-label="Close domains panel">
|
||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
|
||
</button>
|
||
</div>
|
||
|
||
<div class="domains-overlay-body">
|
||
|
||
<!-- DOMAIN: Mechanics (Classical) -->
|
||
<section class="domain-section" aria-labelledby="domain-mechanics">
|
||
<div class="domain-section-header">
|
||
<i data-lucide="settings-2" class="domain-icon" width="22" height="22" aria-hidden="true"></i>
|
||
<div>
|
||
<h3 id="domain-mechanics" class="domain-name">Mechanics <span class="domain-sub">(Classical)</span></h3>
|
||
<p class="domain-desc">Motion, forces, energy, and the laws governing macroscopic physical systems.</p>
|
||
</div>
|
||
<span class="domain-badge domain-badge--active">Parent Domain</span>
|
||
</div>
|
||
<ul class="concept-list">
|
||
<li class="concept-item concept-item--live"><a href="Concepts/newtons-laws-of-motion.html">Newton's Laws of Motion</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/conservation-of-energy.html">Conservation of Energy</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/conservation-of-momentum.html">Conservation of Momentum & Angular Momentum</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/work-energy-principle.html">Work-Energy Principle</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/rotational-dynamics.html">Rotational Dynamics</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/simple-oscillations.html">Oscillations and Harmonic Motion</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/lagrangian-hamiltonian-mechanics.html">Lagrangian & Hamiltonian Mechanics</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/principle-of-least-action.html">Principle of Least Action</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/noethers-theorem.html">Noether's Theorem</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/chaos-and-nonlinear-dynamics.html">Chaos and Nonlinear Dynamics</a><span class="concept-status">Live</span></li>
|
||
</ul>
|
||
</section>
|
||
|
||
<div class="domain-divider" role="separator"></div>
|
||
|
||
<!-- DOMAIN: Waves & Optics -->
|
||
<section class="domain-section" aria-labelledby="domain-waves">
|
||
<div class="domain-section-header">
|
||
<i data-lucide="waves" class="domain-icon" width="22" height="22" aria-hidden="true"></i>
|
||
<div>
|
||
<h3 id="domain-waves" class="domain-name">Waves & Optics</h3>
|
||
<p class="domain-desc">Wave propagation, interference, diffraction, and the nature of light.</p>
|
||
</div>
|
||
<span class="domain-badge domain-badge--active">Parent Domain</span>
|
||
</div>
|
||
<ul class="concept-list">
|
||
<li class="concept-item concept-item--live"><a href="Concepts/wave-interference.html">Wave Interference</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/gravitational-waves.html">Gravitational Waves</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/wave-equation.html">Wave Equation and Superposition Principle</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/diffraction.html">Diffraction</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/polarization-of-waves.html">Polarization of Waves</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Geometrical Optics</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Physical Optics</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Lasers and Coherence</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Optical Instruments</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
</ul>
|
||
</section>
|
||
|
||
<div class="domain-divider" role="separator"></div>
|
||
|
||
<!-- DOMAIN: Electromagnetism -->
|
||
<section class="domain-section" aria-labelledby="domain-em">
|
||
<div class="domain-section-header">
|
||
<i data-lucide="zap" class="domain-icon" width="22" height="22" aria-hidden="true"></i>
|
||
<div>
|
||
<h3 id="domain-em" class="domain-name">Electromagnetism</h3>
|
||
<p class="domain-desc">Electric fields, magnetic fields, and Maxwell's unified theory.</p>
|
||
</div>
|
||
<span class="domain-badge domain-badge--active">Parent Domain</span>
|
||
</div>
|
||
<ul class="concept-list">
|
||
<li class="concept-item concept-item--live"><a href="Concepts/electric-fields.html">Electric Fields</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/magnetic-fields.html">Magnetic Fields</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Coulomb's Law</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Electric Fields & Potentials</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Gauss's Law</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Biot-Savart Law and Ampère's Law</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Faraday's Law of Induction</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Maxwell's Equations</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Lorentz Force Law</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Electromagnetic Waves</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Electric Circuits</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
</ul>
|
||
</section>
|
||
|
||
<div class="domain-divider" role="separator"></div>
|
||
|
||
<!-- DOMAIN: Thermodynamics & Statistical Mechanics -->
|
||
<section class="domain-section" aria-labelledby="domain-thermo">
|
||
<div class="domain-section-header">
|
||
<i data-lucide="flame" class="domain-icon" width="22" height="22" aria-hidden="true"></i>
|
||
<div>
|
||
<h3 id="domain-thermo" class="domain-name">Thermodynamics <span class="domain-sub">& Statistical Mechanics</span></h3>
|
||
<p class="domain-desc">Heat, entropy, thermodynamic laws, and statistical description of matter.</p>
|
||
</div>
|
||
<span class="domain-badge domain-badge--new">New Domain</span>
|
||
</div>
|
||
<ul class="concept-list">
|
||
<li class="concept-item concept-item--soon"><span>Zeroth Law (Thermal Equilibrium)</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>First Law (Conservation of Energy)</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Second Law (Entropy Increase)</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Third Law (Absolute Entropy)</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Entropy (Boltzmann's Equation)</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Thermodynamic Potentials</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Kinetic Theory of Gases</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Statistical Ensembles</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Phase Transitions</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Heat Engines & Carnot Cycle</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
</ul>
|
||
</section>
|
||
|
||
<div class="domain-divider" role="separator"></div>
|
||
|
||
<!-- DOMAIN: Quantum Mechanics -->
|
||
<section class="domain-section" aria-labelledby="domain-quantum">
|
||
<div class="domain-section-header">
|
||
<i data-lucide="atom" class="domain-icon" width="22" height="22" aria-hidden="true"></i>
|
||
<div>
|
||
<h3 id="domain-quantum" class="domain-name">Quantum Mechanics</h3>
|
||
<p class="domain-desc">Wave functions, uncertainty, superposition, and the quantum world.</p>
|
||
</div>
|
||
<span class="domain-badge domain-badge--active">Parent Domain</span>
|
||
</div>
|
||
<ul class="concept-list">
|
||
<li class="concept-item concept-item--live"><a href="Concepts/double-slit-experiment.html">Double Slit Experiment</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Photoelectric Effect</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Blackbody Radiation</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Bohr Model of Atom</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>de Broglie Waves</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Heisenberg Uncertainty Principle</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Schrödinger Equation</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Pauli Exclusion Principle</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Spin and Angular Momentum</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Quantum Statistics</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Quantum Field Theory</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
</ul>
|
||
</section>
|
||
|
||
<div class="domain-divider" role="separator"></div>
|
||
|
||
<!-- DOMAIN: Relativity -->
|
||
<section class="domain-section" aria-labelledby="domain-relativity">
|
||
<div class="domain-section-header">
|
||
<i data-lucide="orbit" class="domain-icon" width="22" height="22" aria-hidden="true"></i>
|
||
<div>
|
||
<h3 id="domain-relativity" class="domain-name">Relativity</h3>
|
||
<p class="domain-desc">Special and general relativity, spacetime curvature, and cosmic phenomena.</p>
|
||
</div>
|
||
<span class="domain-badge domain-badge--active">Parent Domain</span>
|
||
</div>
|
||
<ul class="concept-list">
|
||
<li class="concept-item concept-item--live"><a href="Concepts/special-relativity.html">Special Relativity</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--live"><a href="Concepts/gravitational-waves.html">Gravitational Waves</a><span class="concept-status">Live</span></li>
|
||
<li class="concept-item concept-item--soon"><span>General Relativity</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Equivalence Principle</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Lorentz Transformation</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Cosmological Models</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
</ul>
|
||
</section>
|
||
|
||
<div class="domain-divider" role="separator"></div>
|
||
|
||
<!-- DOMAIN: Atomic, Nuclear & Particle Physics -->
|
||
<section class="domain-section" aria-labelledby="domain-nuclear">
|
||
<div class="domain-section-header">
|
||
<i data-lucide="circle-dot" class="domain-icon" width="22" height="22" aria-hidden="true"></i>
|
||
<div>
|
||
<h3 id="domain-nuclear" class="domain-name">Atomic, Nuclear <span class="domain-sub">& Particle Physics</span></h3>
|
||
<p class="domain-desc">Sub-atomic structure, nuclear reactions, and the Standard Model of particles.</p>
|
||
</div>
|
||
<span class="domain-badge domain-badge--new">New Domain</span>
|
||
</div>
|
||
<ul class="concept-list">
|
||
<li class="concept-item concept-item--soon"><span>Atomic Structure</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Radioactivity</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Nuclear Physics</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Elementary Particles</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Standard Model</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
</ul>
|
||
</section>
|
||
|
||
<div class="domain-divider" role="separator"></div>
|
||
|
||
<!-- DOMAIN: Condensed Matter & AMO -->
|
||
<section class="domain-section" aria-labelledby="domain-condensed">
|
||
<div class="domain-section-header">
|
||
<i data-lucide="microscope" class="domain-icon" width="22" height="22" aria-hidden="true"></i>
|
||
<div>
|
||
<h3 id="domain-condensed" class="domain-name">Condensed Matter <span class="domain-sub">& AMO</span></h3>
|
||
<p class="domain-desc">Solid-state physics, band theory, superconductivity, and atomic optics.</p>
|
||
</div>
|
||
<span class="domain-badge domain-badge--new">New Domain</span>
|
||
</div>
|
||
<ul class="concept-list">
|
||
<li class="concept-item concept-item--soon"><span>Crystal Lattices & Bragg Diffraction</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Band Theory of Solids</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Superconductivity</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Semiconductors & Transistors</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Quantum Hall Effect</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
</ul>
|
||
</section>
|
||
|
||
<div class="domain-divider" role="separator"></div>
|
||
|
||
<!-- DOMAIN: Astrophysics & Cosmology -->
|
||
<section class="domain-section" aria-labelledby="domain-astro">
|
||
<div class="domain-section-header">
|
||
<i data-lucide="telescope" class="domain-icon" width="22" height="22" aria-hidden="true"></i>
|
||
<div>
|
||
<h3 id="domain-astro" class="domain-name">Astrophysics <span class="domain-sub">& Cosmology</span></h3>
|
||
<p class="domain-desc">Stars, black holes, the Big Bang, and the large-scale structure of the universe.</p>
|
||
</div>
|
||
<span class="domain-badge domain-badge--new">New Domain</span>
|
||
</div>
|
||
<ul class="concept-list">
|
||
<li class="concept-item concept-item--soon"><span>Stellar Structure & Evolution</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Cosmology (Big Bang, CMB)</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Black Holes & GR</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Dark Matter & Dark Energy</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
</ul>
|
||
</section>
|
||
|
||
<div class="domain-divider" role="separator"></div>
|
||
|
||
<!-- DOMAIN: Cross-Disciplinary & Methods -->
|
||
<section class="domain-section" aria-labelledby="domain-methods">
|
||
<div class="domain-section-header">
|
||
<i data-lucide="compass" class="domain-icon" width="22" height="22" aria-hidden="true"></i>
|
||
<div>
|
||
<h3 id="domain-methods" class="domain-name">Cross-Disciplinary <span class="domain-sub">& Methods</span></h3>
|
||
<p class="domain-desc">Mathematical tools, computational methods, and instrumentation spanning all domains.</p>
|
||
</div>
|
||
<span class="domain-badge domain-badge--new">New Domain</span>
|
||
</div>
|
||
<ul class="concept-list">
|
||
<li class="concept-item concept-item--soon"><span>Statistical & Computational Methods</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Mathematical Tools</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Instrumentation & Measurement</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
<li class="concept-item concept-item--soon"><span>Chaos & Complexity</span><span class="concept-status concept-status--soon">Roadmap</span></li>
|
||
</ul>
|
||
</section>
|
||
|
||
</div><!-- /.domains-overlay-body -->
|
||
</div><!-- /.domains-overlay-panel -->
|
||
</div><!-- /#domainsOverlay -->
|
||
|
||
<!-- Scripts -->
|
||
<script src="js/common.js"></script>
|
||
<script>
|
||
// ------------------------------------------------------------------
|
||
// DATA
|
||
// ------------------------------------------------------------------
|
||
const DATA = [
|
||
{
|
||
id: 'oscillation',
|
||
title: 'Harmonic Oscillation',
|
||
domain: 'Mechanics',
|
||
desc: 'Restoring forces, damping, and resonance in spring-mass systems.',
|
||
type: 'oscillation',
|
||
href: 'Concepts/simple-oscillations.html'
|
||
},
|
||
{
|
||
id: 'projectile',
|
||
title: 'Projectile Motion',
|
||
domain: 'Mechanics',
|
||
desc: 'Kinematics of objects in flight under the influence of gravity and drag.',
|
||
type: 'projectile',
|
||
href: 'Concepts/projectile-motion.html'
|
||
},
|
||
{
|
||
id: 'chaos',
|
||
title: 'Chaos and Nonlinear Dynamics',
|
||
domain: 'Mechanics',
|
||
desc: 'Deterministic chaos, strange attractors, and sensitive dependence on initial conditions.',
|
||
type: 'chaos',
|
||
href: 'Concepts/chaos-and-nonlinear-dynamics.html'
|
||
},
|
||
{
|
||
id: 'waves',
|
||
title: 'Wave Interference',
|
||
domain: 'Waves',
|
||
desc: 'Superposition principle, constructive and destructive interference.',
|
||
type: 'waves',
|
||
href: 'Concepts/wave-interference.html'
|
||
},
|
||
{
|
||
id: 'wave-equation',
|
||
title: 'Wave Equation',
|
||
domain: 'Waves',
|
||
desc: 'The fundamental PDE of wave motion and the mathematical linearity that allows waves to exist independently.',
|
||
type: 'wave-equation',
|
||
href: 'Concepts/wave-equation.html'
|
||
},
|
||
{
|
||
id: 'orbit',
|
||
title: 'Orbital Mechanics',
|
||
domain: 'Mechanics',
|
||
desc: 'Kepler’s laws and gravitational attraction between celestial bodies.',
|
||
type: 'orbit',
|
||
href: 'Concepts/orbital-mechanics.html'
|
||
},
|
||
{
|
||
id: 'fields',
|
||
title: 'Electric Fields',
|
||
domain: 'Electromagnetism',
|
||
desc: 'Visualizing vector fields generated by point charges.',
|
||
type: 'fields',
|
||
href: 'Concepts/electric-fields.html'
|
||
},
|
||
{
|
||
id: 'magnetic',
|
||
title: 'Magnetic Fields',
|
||
domain: 'Electromagnetism',
|
||
desc: 'Magnetic dipoles, current-carrying wires, and electromagnetic induction.',
|
||
type: 'magnetic',
|
||
href: 'Concepts/magnetic-fields.html'
|
||
},
|
||
{
|
||
id: 'double-slit',
|
||
title: 'Double Slit Experiment',
|
||
domain: 'Quantum',
|
||
desc: 'The probabilistic nature of photons and wave-particle duality.',
|
||
type: 'slit',
|
||
href: 'Concepts/double-slit-experiment.html'
|
||
},
|
||
{
|
||
id: 'pendulum',
|
||
title: 'Simple Pendulum',
|
||
domain: 'Mechanics',
|
||
desc: 'Periodicity and small-angle approximation in suspended masses.',
|
||
type: 'pendulum',
|
||
href: 'Concepts/simple-pendulum.html'
|
||
},
|
||
{
|
||
id: 'gravitational-waves',
|
||
title: 'Gravitational Waves',
|
||
domain: 'Waves',
|
||
desc: 'Ripples in spacetime from cosmic events and LIGO detection.',
|
||
type: 'gravitational-waves',
|
||
href: 'Concepts/gravitational-waves.html'
|
||
},
|
||
{
|
||
id: 'newtons-laws',
|
||
title: 'Newton\'s Laws',
|
||
domain: 'Mechanics',
|
||
desc: 'The fundamental laws defining the relationship between an object\'s motion and forces.',
|
||
type: 'newtons-laws',
|
||
href: 'Concepts/newtons-laws-of-motion.html'
|
||
},
|
||
{
|
||
id: 'conservation-of-energy',
|
||
title: 'Conservation of Energy',
|
||
domain: 'Mechanics',
|
||
desc: 'Energy cannot be created or destroyed, only transformed from one form to another.',
|
||
type: 'conservation-energy',
|
||
href: 'Concepts/conservation-of-energy.html'
|
||
},
|
||
{
|
||
id: 'conservation-momentum',
|
||
title: 'Conservation of Momentum',
|
||
domain: 'Mechanics',
|
||
desc: 'The principle that the total momentum of a closed system remains constant.',
|
||
type: 'conservation-momentum',
|
||
href: 'Concepts/conservation-of-momentum.html'
|
||
},
|
||
{
|
||
id: 'work-energy',
|
||
title: 'Work-Energy Principle',
|
||
domain: 'Mechanics',
|
||
desc: 'The net work done on an object is equal to its change in kinetic energy.',
|
||
type: 'work-energy',
|
||
href: 'Concepts/work-energy-principle.html'
|
||
},
|
||
{
|
||
id: 'special-relativity',
|
||
title: 'Special Relativity',
|
||
domain: 'Relativity',
|
||
desc: 'Time dilation, length contraction, and the cosmic speed limit of light.',
|
||
type: 'special-relativity',
|
||
href: 'Concepts/special-relativity.html'
|
||
},
|
||
{
|
||
id: 'rotational-dynamics',
|
||
title: 'Rotational Dynamics',
|
||
domain: 'Mechanics',
|
||
desc: 'Torque, moment of inertia, angular acceleration, and the conservation of angular momentum.',
|
||
type: 'rotational-dynamics',
|
||
href: 'Concepts/rotational-dynamics.html'
|
||
},
|
||
{
|
||
id: 'lagrangian-hamiltonian-mechanics',
|
||
title: 'Lagrangian & Hamiltonian Mechanics',
|
||
domain: 'Mechanics',
|
||
desc: 'Reformulating physics using scalar energy, generalized coordinates, action principles, and phase space flow.',
|
||
type: 'lagrangian-hamiltonian',
|
||
href: 'Concepts/lagrangian-hamiltonian-mechanics.html'
|
||
},
|
||
{
|
||
id: 'principle-of-least-action',
|
||
title: 'Principle of Least Action',
|
||
domain: 'Mechanics',
|
||
desc: 'Nature selects the unique path that makes the action stationary — the variational foundation of all modern physics.',
|
||
type: 'least-action',
|
||
href: 'Concepts/principle-of-least-action.html'
|
||
},
|
||
{
|
||
id: 'noethers-theorem',
|
||
title: "Noether's Theorem",
|
||
domain: 'Mechanics',
|
||
desc: 'Every continuous symmetry of a physical system yields a conserved quantity — the deep bridge between symmetry and conservation laws.',
|
||
type: 'noethers-theorem',
|
||
href: 'Concepts/noethers-theorem.html'
|
||
},
|
||
{
|
||
id: 'diffraction',
|
||
title: 'Diffraction',
|
||
domain: 'Waves',
|
||
desc: 'The spreading out of waves as they pass through an aperture or around an obstacle.',
|
||
type: 'diffraction',
|
||
href: 'Concepts/diffraction.html'
|
||
},
|
||
{
|
||
id: 'polarization',
|
||
title: 'Polarization of Waves',
|
||
domain: 'Waves',
|
||
desc: 'The geometric orientation of a wave\'s oscillations and its behavior as it passes through filters.',
|
||
type: 'polarization',
|
||
href: 'Concepts/polarization-of-waves.html'
|
||
}
|
||
];
|
||
|
||
// ------------------------------------------------------------------
|
||
// VISUALIZATION CLASSES (Mini-Sims)
|
||
// ------------------------------------------------------------------
|
||
|
||
class BaseVisual {
|
||
constructor(canvas) {
|
||
this.canvas = canvas;
|
||
this.ctx = canvas.getContext('2d');
|
||
this.isVisible = false;
|
||
|
||
// Initialize Colors
|
||
this.updateColors();
|
||
|
||
// Random start time so they're not all synced perfectly
|
||
this.time = Math.random() * 100;
|
||
|
||
// Initial resize
|
||
this.resize();
|
||
}
|
||
|
||
updateColors() {
|
||
this.color = getComputedStyle(document.body).getPropertyValue('--text-main').trim();
|
||
this.accent = getComputedStyle(document.body).getPropertyValue('--accent').trim();
|
||
this.accentSecondary = getComputedStyle(document.body).getPropertyValue('--accent-secondary').trim() || '#3498db'; // Fallback
|
||
}
|
||
|
||
resize() {
|
||
const rect = this.canvas.parentElement.getBoundingClientRect();
|
||
this.canvas.width = rect.width;
|
||
this.canvas.height = rect.height;
|
||
this.width = this.canvas.width;
|
||
this.height = this.canvas.height;
|
||
}
|
||
|
||
clear() {
|
||
this.ctx.clearRect(0, 0, this.width, this.height);
|
||
}
|
||
|
||
// Should be overridden
|
||
draw() { }
|
||
}
|
||
|
||
class OscillationVisual extends BaseVisual {
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.05;
|
||
this.clear();
|
||
const x = Math.sin(this.time) * (this.width * 0.3);
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
|
||
this.ctx.strokeStyle = this.color;
|
||
this.ctx.lineWidth = 1.5;
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx - (this.width * 0.35), cy);
|
||
for (let i = 0; i < 20; i++) {
|
||
let px = (cx - (this.width * 0.35)) + ((x + (this.width * 0.35)) / 20) * i;
|
||
let py = cy + (i % 2 == 0 ? -5 : 5);
|
||
this.ctx.lineTo(px, py);
|
||
}
|
||
this.ctx.lineTo(cx + x, cy);
|
||
this.ctx.stroke();
|
||
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(cx + x, cy, 8, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
}
|
||
}
|
||
|
||
class ProjectileVisual extends BaseVisual {
|
||
constructor(c) { super(c); this.t = 0; }
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.t += 0.02;
|
||
if (this.t > 2) this.t = 0;
|
||
this.clear();
|
||
|
||
const startX = 20;
|
||
const startY = this.height - 20;
|
||
const simX = this.t * (this.width * 0.8);
|
||
const normT = this.t / 2;
|
||
const simY = (normT * 4 - Math.pow(normT * 2, 2)) * (this.height * 0.8);
|
||
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(startX + simX, startY - simY, 6, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
|
||
this.ctx.strokeStyle = this.color;
|
||
this.ctx.globalAlpha = 0.2;
|
||
this.ctx.beginPath();
|
||
for (let i = 0; i < this.t; i += 0.05) {
|
||
let sx = i * (this.width * 0.8);
|
||
let nT = i / 2;
|
||
let sy = (nT * 4 - Math.pow(nT * 2, 2)) * (this.height * 0.8);
|
||
this.ctx.lineTo(startX + sx, startY - sy);
|
||
}
|
||
this.ctx.stroke();
|
||
this.ctx.globalAlpha = 1;
|
||
}
|
||
}
|
||
|
||
class WavesVisual extends BaseVisual {
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.05;
|
||
this.clear();
|
||
this.ctx.beginPath();
|
||
this.ctx.strokeStyle = this.accent;
|
||
this.ctx.lineWidth = 2;
|
||
|
||
for (let x = 0; x < this.width; x += 5) {
|
||
const y = Math.sin(x * 0.05 + this.time) * 20 + Math.sin(x * 0.03 - this.time) * 10;
|
||
if (x === 0) this.ctx.moveTo(x, this.height / 2 + y);
|
||
else this.ctx.lineTo(x, this.height / 2 + y);
|
||
}
|
||
this.ctx.stroke();
|
||
}
|
||
}
|
||
|
||
class OrbitVisual extends BaseVisual {
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.03;
|
||
this.clear();
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(cx, cy, 15, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
|
||
const rx = this.width * 0.3;
|
||
const ry = this.height * 0.2;
|
||
const x = cx + Math.cos(this.time) * rx;
|
||
const y = cy + Math.sin(this.time) * ry;
|
||
|
||
this.ctx.strokeStyle = this.color;
|
||
this.ctx.globalAlpha = 0.1;
|
||
this.ctx.beginPath();
|
||
this.ctx.ellipse(cx, cy, rx, ry, 0, 0, Math.PI * 2);
|
||
this.ctx.stroke();
|
||
this.ctx.globalAlpha = 1;
|
||
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(x, y, 6, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
}
|
||
}
|
||
|
||
class FieldVisual extends BaseVisual {
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.02;
|
||
this.clear();
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
|
||
this.ctx.fillStyle = this.color;
|
||
for (let x = 20; x < this.width; x += 40) {
|
||
for (let y = 20; y < this.height; y += 40) {
|
||
const dx = x - cx;
|
||
const dy = y - cy;
|
||
const dist = Math.sqrt(dx * dx + dy * dy);
|
||
const offset = (this.time * 20) % 20;
|
||
const angle = Math.atan2(dy, dx);
|
||
const px = x + Math.cos(angle) * offset;
|
||
const py = y + Math.sin(angle) * offset;
|
||
const size = Math.max(0, 3 - (dist / 150));
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(px, py, size, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
class PendulumVisual extends BaseVisual {
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.05;
|
||
this.clear();
|
||
const cx = this.width / 2;
|
||
const angle = Math.sin(this.time) * 0.5;
|
||
const len = this.height * 0.6;
|
||
const endX = cx + Math.sin(angle) * len;
|
||
const endY = 20 + Math.cos(angle) * len;
|
||
|
||
this.ctx.strokeStyle = this.color;
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx, 20);
|
||
this.ctx.lineTo(endX, endY);
|
||
this.ctx.stroke();
|
||
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(endX, endY, 10, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
}
|
||
}
|
||
|
||
class ConservationEnergyVisual extends BaseVisual {
|
||
constructor(canvas) {
|
||
super(canvas);
|
||
this.angle = 0;
|
||
this.barW = 15;
|
||
this.maxH = 40;
|
||
}
|
||
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.angle += 0.05;
|
||
|
||
// Clear
|
||
this.clear();
|
||
|
||
// Two bars trading height
|
||
const pe = (Math.sin(this.angle) + 1) / 2; // 0 to 1
|
||
const ke = 1 - pe;
|
||
|
||
const baseY = (this.height / 2) + 25;
|
||
const cx = this.width / 2;
|
||
|
||
// PE Bar
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.fillRect(cx - 25, baseY - (pe * this.maxH), this.barW, pe * this.maxH);
|
||
|
||
// KE Bar
|
||
this.ctx.fillStyle = '#3498db'; // Another distinct color
|
||
this.ctx.fillRect(cx + 10, baseY - (ke * this.maxH), this.barW, ke * this.maxH);
|
||
|
||
// Total Energy Line (Constant)
|
||
this.ctx.strokeStyle = this.color;
|
||
this.ctx.lineWidth = 1;
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx - 35, baseY - this.maxH);
|
||
this.ctx.lineTo(cx + 35, baseY - this.maxH);
|
||
this.ctx.stroke();
|
||
|
||
// Base Line
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx - 35, baseY);
|
||
this.ctx.lineTo(cx + 35, baseY);
|
||
this.ctx.stroke();
|
||
}
|
||
}
|
||
|
||
class MomentumVisual extends BaseVisual {
|
||
constructor(canvas) {
|
||
super(canvas);
|
||
this.time = 0;
|
||
this.m1 = 15;
|
||
this.m2 = 25;
|
||
this.x1 = 20;
|
||
this.x2 = this.width - 20; // Initialize x2 based on canvas width
|
||
this.v1 = 1.5;
|
||
this.v2 = -1;
|
||
}
|
||
|
||
// Override resize to re-initialize x2
|
||
resize() {
|
||
super.resize();
|
||
this.x2 = this.width - 20;
|
||
}
|
||
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.clear();
|
||
|
||
// Update positions
|
||
this.x1 += this.v1;
|
||
this.x2 += this.v2;
|
||
|
||
// Elastic Collision logic
|
||
// Check for collision: if balls are overlapping and moving towards each other
|
||
if (Math.abs(this.x1 - this.x2) <= (this.m1 + this.m2) / 2 && ((this.v1 > 0 && this.v2 < 0) || (this.v1 < 0 && this.v2 > 0))) {
|
||
const tempV1 = this.v1;
|
||
this.v1 = (this.v1 * (this.m1 - this.m2) + (2 * this.m2 * this.v2)) / (this.m1 + this.m2);
|
||
this.v2 = (this.v2 * (this.m2 - this.m1) + (2 * this.m1 * tempV1)) / (this.m1 + this.m2);
|
||
// Small adjustment to prevent sticking
|
||
this.x1 += this.v1 * 0.5;
|
||
this.x2 += this.v2 * 0.5;
|
||
}
|
||
|
||
// Reset when out of bounds
|
||
if (this.x1 < -50 || this.x2 > this.width + 50 || this.x1 > this.width + 50 || this.x2 < -50) {
|
||
this.x1 = 20; this.v1 = 1.5;
|
||
this.x2 = this.width - 20; this.v2 = -1;
|
||
}
|
||
|
||
const py = this.height / 2;
|
||
|
||
const drawBall = (x, r, colorCode) => {
|
||
this.ctx.fillStyle = colorCode;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(x, py, r, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
|
||
// Motion blur / trail hint
|
||
this.ctx.globalAlpha = 0.3;
|
||
this.ctx.beginPath();
|
||
// Draw a slightly offset, faded circle in the direction of motion
|
||
const trailOffset = (this.v1 > 0 && x === this.x1) || (this.v2 > 0 && x === this.x2) ? -5 : 5;
|
||
this.ctx.arc(x + trailOffset, py, r, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
this.ctx.globalAlpha = 1.0;
|
||
};
|
||
|
||
drawBall(this.x1, this.m1, this.accent);
|
||
drawBall(this.x2, this.m2, this.accentSecondary);
|
||
}
|
||
}
|
||
|
||
class SlitVisual extends BaseVisual {
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.1;
|
||
this.clear();
|
||
const bands = 20;
|
||
const w = this.width / bands;
|
||
for (let i = 0; i < bands; i++) {
|
||
const center = bands / 2;
|
||
const dist = Math.abs(i - center);
|
||
const intensity = Math.max(0, 1 - (dist * 0.2)) + (Math.sin(this.time + i) * 0.1);
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.globalAlpha = intensity * 0.8;
|
||
this.ctx.fillRect(i * w, 0, w, this.height);
|
||
}
|
||
this.ctx.globalAlpha = 1;
|
||
}
|
||
}
|
||
|
||
class MagneticVisual extends BaseVisual {
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.02;
|
||
this.clear();
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
|
||
// Rotating dipole moment
|
||
const mx = Math.cos(this.time);
|
||
const my = Math.sin(this.time);
|
||
|
||
// Draw grid of compass needles
|
||
const spacing = 30;
|
||
for (let x = spacing / 2; x < this.width; x += spacing) {
|
||
for (let y = spacing / 2; y < this.height; y += spacing) {
|
||
const dx = x - cx;
|
||
const dy = y - cy;
|
||
const r2 = dx * dx + dy * dy;
|
||
|
||
// Avoid singularity at the exact center
|
||
if (r2 < spacing * spacing / 4) continue;
|
||
|
||
const r = Math.sqrt(r2);
|
||
const r5 = r2 * r2 * r;
|
||
|
||
// Dot product m * r
|
||
const m_dot_r = mx * dx + my * dy;
|
||
|
||
// B vector (dipole field)
|
||
// B ∝ 3 * (m . r) * r - r^2 * m
|
||
const bx = (3 * m_dot_r * dx - r2 * mx) / r5;
|
||
const by = (3 * m_dot_r * dy - r2 * my) / r5;
|
||
|
||
// Normalize B for drawing direction
|
||
const bMag = Math.sqrt(bx * bx + by * by);
|
||
if (bMag === 0) continue;
|
||
const nx = bx / bMag;
|
||
const ny = by / bMag;
|
||
|
||
// Opacity based on field strength (normalized roughly for visual appeal)
|
||
// At r=100, r^3 = 1,000,000.
|
||
const strength = Math.min(1, 1000000 / (r2 * r));
|
||
|
||
const len = spacing * 0.35;
|
||
|
||
this.ctx.globalAlpha = 0.15 + 0.85 * strength;
|
||
this.ctx.strokeStyle = this.accent;
|
||
this.ctx.lineWidth = 1.5;
|
||
|
||
// Draw needle line
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(x - nx * len, y - ny * len);
|
||
this.ctx.lineTo(x + nx * len, y + ny * len);
|
||
this.ctx.stroke();
|
||
|
||
// Draw needle head (pointing in direction of B)
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(x + nx * len, y + ny * len, 1.5, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
}
|
||
}
|
||
|
||
this.ctx.globalAlpha = 1;
|
||
|
||
// Draw the central dipole (a tiny bar magnet)
|
||
const magLen = 15;
|
||
this.ctx.lineWidth = 6;
|
||
this.ctx.lineCap = 'round';
|
||
|
||
// North pole (red)
|
||
this.ctx.strokeStyle = '#e74c3c';
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx, cy);
|
||
this.ctx.lineTo(cx + mx * magLen, cy + my * magLen);
|
||
this.ctx.stroke();
|
||
|
||
// South pole (blue)
|
||
this.ctx.strokeStyle = '#3498db';
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx, cy);
|
||
this.ctx.lineTo(cx - mx * magLen, cy - my * magLen);
|
||
this.ctx.stroke();
|
||
|
||
this.ctx.lineCap = 'butt'; // reset
|
||
}
|
||
}
|
||
|
||
class GravitationalWavesVisual extends BaseVisual {
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.02;
|
||
this.clear();
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
|
||
this.ctx.strokeStyle = this.accent;
|
||
this.ctx.lineWidth = 1.5;
|
||
|
||
// Draw expanding rings (quadrupole pattern approximation)
|
||
for (let i = 0; i < 4; i++) {
|
||
const radius = ((this.time * 20 + i * 40) % 150) + 10;
|
||
const alpha = 1 - (radius / 160);
|
||
|
||
this.ctx.globalAlpha = Math.max(0, alpha);
|
||
this.ctx.beginPath();
|
||
|
||
// Elliptical distortion to simulate quadrupole wave
|
||
const distortX = 1 + 0.2 * Math.sin(this.time * 2);
|
||
const distortY = 1 - 0.2 * Math.sin(this.time * 2);
|
||
|
||
this.ctx.ellipse(cx, cy, radius * distortX, radius * distortY, 0, 0, Math.PI * 2);
|
||
this.ctx.stroke();
|
||
}
|
||
|
||
this.ctx.globalAlpha = 1;
|
||
|
||
// Draw rotating binary system in center
|
||
const binaryAngle = this.time * 5;
|
||
const binarySep = 10;
|
||
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(cx + Math.cos(binaryAngle) * binarySep, cy + Math.sin(binaryAngle) * binarySep, 4, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(cx - Math.cos(binaryAngle) * binarySep, cy - Math.sin(binaryAngle) * binarySep, 4, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
}
|
||
}
|
||
|
||
class NewtonsLawsVisual extends BaseVisual {
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.05;
|
||
this.clear();
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
|
||
const offset = Math.abs(Math.sin(this.time)) * 20;
|
||
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.beginPath();
|
||
this.ctx.roundRect(cx - 15 - offset, cy - 10, 20, 20, 4);
|
||
this.ctx.fill();
|
||
|
||
this.ctx.strokeStyle = this.color;
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.lineWidth = 2;
|
||
|
||
// Arrows pointing outwards
|
||
this.ctx.beginPath(); this.ctx.moveTo(cx - 20 - offset, cy); this.ctx.lineTo(cx - 30 - offset, cy); this.ctx.stroke();
|
||
|
||
this.ctx.beginPath();
|
||
this.ctx.roundRect(cx + 15 + offset, cy - 10, 20, 20, 4);
|
||
this.ctx.fill();
|
||
|
||
this.ctx.beginPath(); this.ctx.moveTo(cx + 20 + offset, cy); this.ctx.lineTo(cx + 30 + offset, cy); this.ctx.stroke();
|
||
}
|
||
}
|
||
|
||
class WorkEnergyCardVisual extends BaseVisual {
|
||
constructor(canvas) {
|
||
super(canvas);
|
||
this.blockX = 20;
|
||
this.blockW = 24;
|
||
this.blockH = 16;
|
||
this.v = 0;
|
||
this.a = 0.05;
|
||
this.maxKE = 1.0;
|
||
}
|
||
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.03;
|
||
this.clear();
|
||
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
const trackY = cy + 10;
|
||
const trackStart = 30;
|
||
const trackEnd = this.width - 30;
|
||
const trackLen = trackEnd - trackStart;
|
||
|
||
// Draw track line
|
||
this.ctx.strokeStyle = this.color;
|
||
this.ctx.globalAlpha = 0.2;
|
||
this.ctx.lineWidth = 2;
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(trackStart, trackY);
|
||
this.ctx.lineTo(trackEnd, trackY);
|
||
this.ctx.stroke();
|
||
this.ctx.globalAlpha = 1.0;
|
||
|
||
// Animate position: accelerates from rest and resets
|
||
const cycleTime = (this.time * 20) % 100;
|
||
let t = cycleTime / 100;
|
||
|
||
let px = trackStart + (t * t) * trackLen;
|
||
let keRatio = t * t;
|
||
|
||
// Draw block
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.beginPath();
|
||
this.ctx.roundRect(px - this.blockW / 2, trackY - this.blockH, this.blockW, this.blockH, 3);
|
||
this.ctx.fill();
|
||
|
||
// Draw Applied Force vector arrow pointing right
|
||
if (t < 0.95) {
|
||
this.ctx.strokeStyle = this.accentSecondary;
|
||
this.ctx.fillStyle = this.accentSecondary;
|
||
this.ctx.lineWidth = 2;
|
||
|
||
const arrowY = trackY - this.blockH / 2;
|
||
const arrowStartX = px - this.blockW / 2 - 25;
|
||
const arrowEndX = px - this.blockW / 2 - 5;
|
||
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(arrowStartX, arrowY);
|
||
this.ctx.lineTo(arrowEndX, arrowY);
|
||
this.ctx.stroke();
|
||
|
||
// Arrowhead
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(arrowEndX, arrowY);
|
||
this.ctx.lineTo(arrowEndX - 5, arrowY - 4);
|
||
this.ctx.lineTo(arrowEndX - 5, arrowY + 4);
|
||
this.ctx.fill();
|
||
|
||
// Small "F" label
|
||
this.ctx.font = '9px monospace';
|
||
this.ctx.fillText("F", arrowStartX + 5, arrowY - 6);
|
||
}
|
||
|
||
// Draw Kinetic Energy progress bar below track
|
||
const barW = 60;
|
||
const barH = 5;
|
||
const barX = cx - barW / 2;
|
||
const barY = cy + 25;
|
||
|
||
// Label KE
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.font = '10px monospace';
|
||
this.ctx.textAlign = 'center';
|
||
this.ctx.fillText(`KE: ${Math.round(keRatio * 100)}%`, cx, barY - 4);
|
||
|
||
// Bar Background
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.globalAlpha = 0.1;
|
||
this.ctx.fillRect(barX, barY, barW, barH);
|
||
this.ctx.globalAlpha = 1.0;
|
||
|
||
// Bar Fill
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.fillRect(barX, barY, barW * keRatio, barH);
|
||
}
|
||
}
|
||
|
||
class SpecialRelativityVisual extends BaseVisual {
|
||
constructor(canvas) {
|
||
super(canvas);
|
||
this.v = 0;
|
||
}
|
||
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.02;
|
||
this.clear();
|
||
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
|
||
// Speed oscillates between 0.0 and 0.90 to show breathing contraction cycles
|
||
const speed = 0.45 + 0.45 * Math.sin(this.time);
|
||
const gamma = 1 / Math.sqrt(1 - speed * speed);
|
||
|
||
// 1. Draw Stationary Reference grid (Observer S) - very faint blue/gray
|
||
this.ctx.strokeStyle = this.color;
|
||
this.ctx.lineWidth = 1;
|
||
this.ctx.globalAlpha = 0.06;
|
||
|
||
const gridSpacing = 16;
|
||
const gridW = 120;
|
||
const gridH = 60;
|
||
|
||
// Horizontal lines
|
||
for (let y = -gridH; y <= gridH; y += gridSpacing) {
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx - gridW, cy + y);
|
||
this.ctx.lineTo(cx + gridW, cy + y);
|
||
this.ctx.stroke();
|
||
}
|
||
|
||
// Vertical lines
|
||
for (let x = -gridW; x <= gridW; x += gridSpacing) {
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx + x, cy - gridH);
|
||
this.ctx.lineTo(cx + x, cy + gridH);
|
||
this.ctx.stroke();
|
||
}
|
||
|
||
// 2. Draw moving coordinate system (Observer S') - relativistic length contracted horizontally!
|
||
this.ctx.strokeStyle = this.accentSecondary;
|
||
this.ctx.lineWidth = 1.5;
|
||
this.ctx.globalAlpha = 0.35;
|
||
|
||
// Contracted spacing along x-axis
|
||
const spacingContracted = gridSpacing / gamma;
|
||
|
||
// Horizontal lines (remain unchanged in transverse height)
|
||
for (let y = -gridH; y <= gridH; y += gridSpacing) {
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx - gridW / gamma, cy + y);
|
||
this.ctx.lineTo(cx + gridW / gamma, cy + y);
|
||
this.ctx.stroke();
|
||
}
|
||
|
||
// Vertical lines (compressed spacing!)
|
||
for (let x = -gridW / gamma; x <= gridW / gamma; x += spacingContracted) {
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx + x, cy - gridH);
|
||
this.ctx.lineTo(cx + x, cy + gridH);
|
||
this.ctx.stroke();
|
||
}
|
||
|
||
this.ctx.globalAlpha = 1.0;
|
||
|
||
// Label showing relative speed ratio v/c
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.font = '10px monospace';
|
||
this.ctx.textAlign = 'center';
|
||
this.ctx.fillText(`v/c: ${speed.toFixed(3)} (γ: ${gamma.toFixed(2)})`, cx, cy + gridH + 18);
|
||
}
|
||
}
|
||
|
||
class RotationalDynamicsVisual extends BaseVisual {
|
||
constructor(canvas) {
|
||
super(canvas);
|
||
this.time = 0;
|
||
}
|
||
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.04;
|
||
this.clear();
|
||
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
const r = Math.min(cx, cy) * 0.7;
|
||
|
||
// Draw central axis
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(cx, cy, 4, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
|
||
// Draw rotating ring/disk
|
||
this.ctx.strokeStyle = this.accent;
|
||
this.ctx.lineWidth = 2;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(cx, cy, r, 0, Math.PI * 2);
|
||
this.ctx.stroke();
|
||
|
||
// Draw two mass point spheres rotating
|
||
const x1 = cx + Math.cos(this.time) * r;
|
||
const y1 = cy + Math.sin(this.time) * r;
|
||
const x2 = cx - Math.cos(this.time) * r;
|
||
const y2 = cy - Math.sin(this.time) * r;
|
||
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(x1, y1, 6, 0, Math.PI * 2);
|
||
this.ctx.arc(x2, y2, 6, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
|
||
// Connecting rod
|
||
this.ctx.strokeStyle = this.color;
|
||
this.ctx.lineWidth = 1;
|
||
this.ctx.globalAlpha = 0.4;
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(x1, y1);
|
||
this.ctx.lineTo(x2, y2);
|
||
this.ctx.stroke();
|
||
this.ctx.globalAlpha = 1.0;
|
||
}
|
||
}
|
||
|
||
class LagrangianHamiltonianVisual extends BaseVisual {
|
||
constructor(canvas) {
|
||
super(canvas);
|
||
this.time = 0;
|
||
}
|
||
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.05;
|
||
this.clear();
|
||
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
const r = Math.min(cx, cy) * 0.45;
|
||
|
||
// Simple chaotic double pendulum visual representation on the card
|
||
const x1 = cx + Math.sin(this.time) * r;
|
||
const y1 = cy + Math.cos(this.time) * r;
|
||
const x2 = x1 + Math.sin(this.time * 2.3) * r * 0.8;
|
||
const y2 = y1 + Math.cos(this.time * 2.3) * r * 0.8;
|
||
|
||
// Draw rods
|
||
this.ctx.strokeStyle = this.color;
|
||
this.ctx.lineWidth = 1.5;
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx, cy);
|
||
this.ctx.lineTo(x1, y1);
|
||
this.ctx.lineTo(x2, y2);
|
||
this.ctx.stroke();
|
||
|
||
// Draw masses
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(x1, y1, 5, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
|
||
this.ctx.fillStyle = this.accentSecondary || this.secondary;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(x2, y2, 5, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
|
||
// Draw pivot point
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(cx, cy, 3, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
}
|
||
}
|
||
|
||
class LeastActionVisual extends BaseVisual {
|
||
constructor(canvas) {
|
||
super(canvas);
|
||
this.time = 0;
|
||
this.theta = 0.8;
|
||
this.omega = 0.0;
|
||
this.trail = [];
|
||
}
|
||
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.05;
|
||
this.clear();
|
||
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
|
||
// Simple pendulum via Euler-Lagrange: theta'' = -(g/l)*sin(theta)
|
||
const alpha = -2.8 * Math.sin(this.theta);
|
||
this.omega += alpha * 0.016;
|
||
this.omega *= 0.9996;
|
||
this.theta += this.omega * 0.016;
|
||
|
||
const pivotY = cy * 0.55;
|
||
const len = Math.min(cx, cy) * 0.72;
|
||
const bobX = cx + Math.sin(this.theta) * len;
|
||
const bobY = pivotY + Math.cos(this.theta) * len;
|
||
|
||
// Trail
|
||
this.trail.push({ x: bobX, y: bobY });
|
||
if (this.trail.length > 120) this.trail.shift();
|
||
|
||
// Draw faint action trail
|
||
if (this.trail.length > 2) {
|
||
this.ctx.strokeStyle = this.accent;
|
||
this.ctx.lineWidth = 1;
|
||
this.ctx.globalAlpha = 0.2;
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(this.trail[0].x, this.trail[0].y);
|
||
for (let i = 1; i < this.trail.length; i++) {
|
||
this.ctx.lineTo(this.trail[i].x, this.trail[i].y);
|
||
}
|
||
this.ctx.stroke();
|
||
this.ctx.globalAlpha = 1.0;
|
||
}
|
||
|
||
// String
|
||
this.ctx.strokeStyle = this.color;
|
||
this.ctx.lineWidth = 1.5;
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx, pivotY);
|
||
this.ctx.lineTo(bobX, bobY);
|
||
this.ctx.stroke();
|
||
|
||
// Pivot
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(cx, pivotY, 3, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
|
||
// Bob
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(bobX, bobY, 7, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
|
||
// Delta S label
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.font = '9px \'JetBrains Mono\', monospace';
|
||
this.ctx.textAlign = 'center';
|
||
this.ctx.globalAlpha = 0.5;
|
||
this.ctx.fillText('\u03B4S = 0', cx, pivotY - 8);
|
||
this.ctx.globalAlpha = 1.0;
|
||
}
|
||
}
|
||
|
||
class NoethersTheoremVisual extends BaseVisual {
|
||
constructor(canvas) {
|
||
super(canvas);
|
||
this.time = 0;
|
||
this.phase = 0;
|
||
this.trail = [];
|
||
}
|
||
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.03;
|
||
this.phase += 0.028;
|
||
this.clear();
|
||
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
|
||
// Three orbiting nodes around a central point — representing
|
||
// the three conservation laws from three symmetries
|
||
const radii = [this.width * 0.28, this.width * 0.22, this.width * 0.16];
|
||
const speeds = [1.0, -1.5, 2.1];
|
||
const colors = [this.accent, this.accentSecondary, this.color];
|
||
const offsets = [0, Math.PI * 2 / 3, Math.PI * 4 / 3];
|
||
|
||
// Faint concentric orbit rings
|
||
radii.forEach((r, i) => {
|
||
this.ctx.strokeStyle = colors[i];
|
||
this.ctx.lineWidth = 1;
|
||
this.ctx.globalAlpha = 0.1;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(cx, cy, r, 0, Math.PI * 2);
|
||
this.ctx.stroke();
|
||
});
|
||
this.ctx.globalAlpha = 1.0;
|
||
|
||
// Orbiting particles
|
||
radii.forEach((r, i) => {
|
||
const angle = this.phase * speeds[i] + offsets[i];
|
||
const px = cx + Math.cos(angle) * r;
|
||
const py = cy + Math.sin(angle) * r;
|
||
|
||
// Radius spoke
|
||
this.ctx.strokeStyle = colors[i];
|
||
this.ctx.lineWidth = 1;
|
||
this.ctx.globalAlpha = 0.2;
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx, cy);
|
||
this.ctx.lineTo(px, py);
|
||
this.ctx.stroke();
|
||
this.ctx.globalAlpha = 1.0;
|
||
|
||
// Particle
|
||
this.ctx.fillStyle = colors[i];
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(px, py, i === 0 ? 6 : i === 1 ? 5 : 4, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
});
|
||
|
||
// Central axis
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.globalAlpha = 0.8;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(cx, cy, 4, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
this.ctx.globalAlpha = 1.0;
|
||
|
||
// Label
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.font = '9px \'JetBrains Mono\', monospace';
|
||
this.ctx.textAlign = 'center';
|
||
this.ctx.globalAlpha = 0.4;
|
||
this.ctx.fillText('E · p · L', cx, cy + this.height * 0.38);
|
||
this.ctx.globalAlpha = 1.0;
|
||
}
|
||
}
|
||
|
||
class ChaosVisual extends BaseVisual {
|
||
constructor(canvas) {
|
||
super(canvas);
|
||
this.time = 0;
|
||
}
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.02;
|
||
this.clear();
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
const r = this.height * 0.25;
|
||
|
||
this.ctx.beginPath();
|
||
for (let i = 0; i < 40; i++) {
|
||
const t = this.time + i * 0.1;
|
||
const x = Math.sin(t * 1.5) * Math.cos(t * 0.5) * r * 1.5;
|
||
const y = Math.sin(t * 1.1) * Math.sin(t * 0.7) * r;
|
||
if (i === 0) this.ctx.moveTo(cx + x, cy + y);
|
||
else this.ctx.lineTo(cx + x, cy + y);
|
||
}
|
||
this.ctx.strokeStyle = this.accent;
|
||
this.ctx.lineWidth = 1.5;
|
||
this.ctx.stroke();
|
||
|
||
this.ctx.beginPath();
|
||
const hx = Math.sin(this.time * 1.5) * Math.cos(this.time * 0.5) * r * 1.5;
|
||
const hy = Math.sin(this.time * 1.1) * Math.sin(this.time * 0.7) * r;
|
||
this.ctx.arc(cx + hx, cy + hy, 3, 0, Math.PI * 2);
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.fill();
|
||
}
|
||
}
|
||
|
||
class WaveEquationVisual extends BaseVisual {
|
||
constructor(canvas) {
|
||
super(canvas);
|
||
this.time = 0;
|
||
}
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.05;
|
||
this.clear();
|
||
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
const amp = Math.min(20, this.height * 0.2);
|
||
const freq = (2 * Math.PI) / (this.width * 0.4);
|
||
|
||
this.ctx.strokeStyle = this.accent;
|
||
this.ctx.lineWidth = 2;
|
||
this.ctx.beginPath();
|
||
for (let x = 0; x < this.width; x += 5) {
|
||
const y = cy + Math.sin(x * freq - this.time) * amp;
|
||
if (x === 0) this.ctx.moveTo(x, y);
|
||
else this.ctx.lineTo(x, y);
|
||
}
|
||
this.ctx.stroke();
|
||
}
|
||
}
|
||
|
||
class PolarizationVisual extends BaseVisual {
|
||
constructor(canvas) {
|
||
super(canvas);
|
||
this.time = 0;
|
||
}
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.05;
|
||
this.clear();
|
||
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
const E0 = Math.min(this.width, this.height) * 0.25;
|
||
|
||
// Elliptical trace
|
||
const x = E0 * Math.cos(this.time);
|
||
const y = -E0 * Math.cos(this.time + Math.PI/3);
|
||
|
||
this.ctx.strokeStyle = this.accentSecondary;
|
||
this.ctx.lineWidth = 2;
|
||
this.ctx.setLineDash([2, 4]);
|
||
this.ctx.beginPath();
|
||
// We'll just draw a generic ellipse for the dash
|
||
this.ctx.ellipse(cx, cy, E0, E0*0.8, -Math.PI/6, 0, Math.PI * 2);
|
||
this.ctx.stroke();
|
||
this.ctx.setLineDash([]);
|
||
|
||
this.ctx.strokeStyle = this.accent;
|
||
this.ctx.lineWidth = 3;
|
||
this.ctx.beginPath();
|
||
this.ctx.moveTo(cx, cy);
|
||
this.ctx.lineTo(cx + x, cy + y);
|
||
this.ctx.stroke();
|
||
|
||
this.ctx.fillStyle = this.accent;
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(cx + x, cy + y, 5, 0, Math.PI * 2);
|
||
this.ctx.fill();
|
||
}
|
||
}
|
||
|
||
class DiffractionVisual extends BaseVisual {
|
||
constructor(canvas) {
|
||
super(canvas);
|
||
this.time = 0;
|
||
}
|
||
draw() {
|
||
if (!this.isVisible) return;
|
||
this.time += 0.05;
|
||
this.clear();
|
||
|
||
const cx = this.width / 2;
|
||
const cy = this.height / 2;
|
||
|
||
this.ctx.fillStyle = this.color;
|
||
this.ctx.fillRect(cx - 2, cy - 40, 4, 30);
|
||
this.ctx.fillRect(cx - 2, cy + 10, 4, 30);
|
||
|
||
this.ctx.strokeStyle = this.accent;
|
||
this.ctx.lineWidth = 1.5;
|
||
|
||
const maxR = 60;
|
||
const speed = 20;
|
||
const phase = (this.time * speed) % 20;
|
||
for(let r = phase; r < maxR; r += 20) {
|
||
this.ctx.globalAlpha = 1 - (r / maxR);
|
||
this.ctx.beginPath();
|
||
this.ctx.arc(cx, cy, r, -Math.PI/3, Math.PI/3);
|
||
this.ctx.stroke();
|
||
}
|
||
this.ctx.globalAlpha = 1;
|
||
}
|
||
}
|
||
|
||
// ------------------------------------------------------------------
|
||
// APP LOGIC
|
||
// ------------------------------------------------------------------
|
||
|
||
const App = {
|
||
visuals: [],
|
||
observer: null,
|
||
pendingVisualTimeouts: [],
|
||
renderVersion: 0,
|
||
|
||
init() {
|
||
this.setupObserver();
|
||
this.setupFilters();
|
||
this.renderGrid(DATA);
|
||
this.animateLoop();
|
||
|
||
// Color updates
|
||
window.addEventListener('theme-changed', () => {
|
||
this.visuals.forEach(v => v.updateColors());
|
||
});
|
||
|
||
window.addEventListener('resize', () => {
|
||
this.visuals.forEach(v => v.resize());
|
||
});
|
||
},
|
||
|
||
setupObserver() {
|
||
this.observer = new IntersectionObserver((entries) => {
|
||
entries.forEach(entry => {
|
||
const visual = this.visuals.find(v => v.canvas === entry.target);
|
||
if (visual) {
|
||
visual.isVisible = entry.isIntersecting;
|
||
}
|
||
});
|
||
}, { threshold: 0.1 });
|
||
},
|
||
|
||
renderGrid(data) {
|
||
const grid = document.getElementById('cardsGrid');
|
||
const renderVersion = ++this.renderVersion;
|
||
|
||
this.pendingVisualTimeouts.forEach(timeoutId => clearTimeout(timeoutId));
|
||
this.pendingVisualTimeouts = [];
|
||
grid.innerHTML = '';
|
||
|
||
// Disconnect old observations
|
||
this.visuals.forEach(v => this.observer.unobserve(v.canvas));
|
||
this.visuals = [];
|
||
|
||
if (data.length === 0) {
|
||
grid.innerHTML = '<div class="message-state">No topics found matching your criteria.</div>';
|
||
return;
|
||
}
|
||
|
||
data.forEach((item, index) => {
|
||
const card = document.createElement('a');
|
||
card.className = 'card';
|
||
card.href = item.href;
|
||
card.style.opacity = 0;
|
||
|
||
card.innerHTML = `
|
||
<div class="card-visual">
|
||
<canvas id="canvas-${item.id}"></canvas>
|
||
</div>
|
||
<div class="card-content">
|
||
<div class="card-tag">${item.domain}</div>
|
||
<h3>${item.title}</h3>
|
||
<p>${item.desc}</p>
|
||
<div class="card-footer">
|
||
<span>Explore Module</span>
|
||
<i data-lucide="arrow-right" class="icon-arrow" width="16"></i>
|
||
</div>
|
||
</div>
|
||
`;
|
||
grid.appendChild(card);
|
||
|
||
// Initialize Visual
|
||
const canvas = card.querySelector('canvas');
|
||
const timeoutId = setTimeout(() => {
|
||
if (renderVersion !== this.renderVersion || !canvas.isConnected) {
|
||
return;
|
||
}
|
||
|
||
let visual;
|
||
switch (item.type) {
|
||
case 'oscillation': visual = new OscillationVisual(canvas); break;
|
||
case 'projectile': visual = new ProjectileVisual(canvas); break;
|
||
case 'waves': visual = new WavesVisual(canvas); break;
|
||
case 'orbit': visual = new OrbitVisual(canvas); break;
|
||
case 'fields': visual = new FieldVisual(canvas); break;
|
||
case 'pendulum': visual = new PendulumVisual(canvas); break;
|
||
case 'slit': visual = new SlitVisual(canvas); break;
|
||
case 'magnetic': visual = new MagneticVisual(canvas); break;
|
||
case 'gravitational-waves': visual = new GravitationalWavesVisual(canvas); break;
|
||
case 'newtons-laws': visual = new NewtonsLawsVisual(canvas); break;
|
||
case 'conservation-energy': visual = new ConservationEnergyVisual(canvas); break;
|
||
case 'conservation-momentum': visual = new MomentumVisual(canvas); break;
|
||
case 'work-energy': visual = new WorkEnergyCardVisual(canvas); break;
|
||
case 'special-relativity': visual = new SpecialRelativityVisual(canvas); break;
|
||
case 'rotational-dynamics': visual = new RotationalDynamicsVisual(canvas); break;
|
||
case 'lagrangian-hamiltonian': visual = new LagrangianHamiltonianVisual(canvas); break;
|
||
case 'least-action': visual = new LeastActionVisual(canvas); break;
|
||
case 'noethers-theorem': visual = new NoethersTheoremVisual(canvas); break;
|
||
case 'chaos': visual = new ChaosVisual(canvas); break;
|
||
case 'wave-equation': visual = new WaveEquationVisual(canvas); break;
|
||
case 'diffraction': visual = new DiffractionVisual(canvas); break;
|
||
case 'polarization': visual = new PolarizationVisual(canvas); break;
|
||
default: visual = new BaseVisual(canvas);
|
||
}
|
||
visual.resize();
|
||
this.visuals.push(visual);
|
||
this.observer.observe(canvas); // OPTIMIZATION: Observe!
|
||
}, 50);
|
||
this.pendingVisualTimeouts.push(timeoutId);
|
||
});
|
||
|
||
if (window.lucide) window.lucide.createIcons();
|
||
|
||
gsap.to('.card', {
|
||
opacity: 1,
|
||
y: 0,
|
||
duration: 0.6,
|
||
stagger: 0.1,
|
||
ease: "power2.out"
|
||
});
|
||
},
|
||
|
||
setupFilters() {
|
||
const searchInput = document.getElementById('searchInput');
|
||
const filterBtns = document.querySelectorAll('.filter-chip');
|
||
let currentFilter = 'all';
|
||
let currentSearch = '';
|
||
|
||
const filterData = () => {
|
||
const filtered = DATA.filter(item => {
|
||
const matchesDomain = currentFilter === 'all' || item.domain === currentFilter;
|
||
const matchesSearch = item.title.toLowerCase().includes(currentSearch) ||
|
||
item.desc.toLowerCase().includes(currentSearch);
|
||
return matchesDomain && matchesSearch;
|
||
});
|
||
this.renderGrid(filtered);
|
||
};
|
||
|
||
searchInput.addEventListener('input', (e) => {
|
||
currentSearch = e.target.value.toLowerCase();
|
||
filterData();
|
||
});
|
||
|
||
filterBtns.forEach(btn => {
|
||
btn.addEventListener('click', () => {
|
||
filterBtns.forEach(b => b.classList.remove('active'));
|
||
btn.classList.add('active');
|
||
currentFilter = btn.dataset.filter;
|
||
filterData();
|
||
});
|
||
});
|
||
},
|
||
|
||
animateLoop() {
|
||
// Loop is always running, but individual draw() calls check isVisible flag
|
||
this.visuals.forEach(v => v.draw());
|
||
requestAnimationFrame(() => this.animateLoop());
|
||
}
|
||
};
|
||
|
||
// ------------------------------------------------------------------
|
||
// DOMAINS OVERLAY
|
||
// ------------------------------------------------------------------
|
||
const DomainsOverlay = {
|
||
overlay: null,
|
||
panel: null,
|
||
openBtn: null,
|
||
closeBtn: null,
|
||
backdrop: null,
|
||
lastFocus: null,
|
||
|
||
init() {
|
||
this.overlay = document.getElementById('domainsOverlay');
|
||
this.panel = this.overlay.querySelector('.domains-overlay-panel');
|
||
this.openBtn = document.getElementById('viewAllDomainsBtn');
|
||
this.closeBtn = document.getElementById('domainsCloseBtn');
|
||
this.backdrop = document.getElementById('domainsOverlayBackdrop');
|
||
|
||
this.openBtn.addEventListener('click', () => this.open());
|
||
this.closeBtn.addEventListener('click', () => this.close());
|
||
this.backdrop.addEventListener('click', () => this.close());
|
||
|
||
document.addEventListener('keydown', (e) => {
|
||
if (e.key === 'Escape' && !this.overlay.hidden) this.close();
|
||
});
|
||
},
|
||
|
||
open() {
|
||
this.lastFocus = document.activeElement;
|
||
this.overlay.hidden = false;
|
||
document.body.style.overflow = 'hidden';
|
||
this.openBtn.setAttribute('aria-expanded', 'true');
|
||
// Small delay so the panel animates in after display
|
||
requestAnimationFrame(() => {
|
||
this.overlay.classList.add('is-open');
|
||
this.closeBtn.focus();
|
||
});
|
||
},
|
||
|
||
close() {
|
||
this.overlay.classList.remove('is-open');
|
||
this.openBtn.setAttribute('aria-expanded', 'false');
|
||
document.body.style.overflow = '';
|
||
// Wait for CSS transition before hiding
|
||
this.panel.addEventListener('transitionend', () => {
|
||
if (!this.overlay.classList.contains('is-open')) {
|
||
this.overlay.hidden = true;
|
||
}
|
||
if (this.lastFocus) this.lastFocus.focus();
|
||
}, { once: true });
|
||
}
|
||
};
|
||
|
||
window.addEventListener('DOMContentLoaded', () => {
|
||
gsap.from('.library-header', { opacity: 0, y: -20, duration: 1, ease: 'power3.out' });
|
||
App.init();
|
||
DomainsOverlay.init();
|
||
});
|
||
|
||
</script>
|
||
</body>
|
||
|
||
</html>
|