-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfourier.html
More file actions
85 lines (74 loc) · 2.64 KB
/
Copy pathfourier.html
File metadata and controls
85 lines (74 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="Visualize Fourier series approximations with interactive spinning circles."
/>
<title>Fourier Series – Fun With Math</title>
<link rel="stylesheet" href="../../css/style.css" />
<link rel="stylesheet" href="../../css/experiments-basic-fourier.css" />
</head>
<body>
<nav>
<a class="brand" href="../../index.html">∑ Fun With Math</a>
<a href="../../index.html">← All Experiments</a>
</nav>
<div class="page-header">
<h1>Fourier Series Visualizer</h1>
<p>Sum of rotating circles that together draw any periodic waveform.</p>
</div>
<div class="experiment-layout">
<div class="col2">
<div class="canvas-wrapper">
<canvas id="circleCanvas"></canvas>
</div>
<div class="canvas-wrapper">
<canvas id="waveCanvas"></canvas>
</div>
</div>
<aside class="controls">
<h3>Controls</h3>
<label>
Harmonics: <span id="termLabel">7</span>
<input type="range" id="termRange" min="1" max="41" step="2" value="7" />
</label>
<label>
Speed: <span id="speedLabel">1.0×</span>
<input type="range" id="speedRange" min="0.1" max="4" step="0.1" value="1" />
</label>
<label>
Waveform
<select id="waveform">
<option value="square">Square Wave</option>
<option value="sawtooth">Sawtooth Wave</option>
<option value="triangle">Triangle Wave</option>
</select>
</label>
<div style="display: flex; gap: 0.5rem; flex-wrap: wrap">
<button class="btn btn-primary" id="toggleBtn">⏸ Pause</button>
<button class="btn btn-secondary" id="clearBtn">Clear Trail</button>
</div>
<div class="info-box">
<h4>Square Wave</h4>
<p>
<code>f(t) = (4/π) Σ sin((2k-1)t) / (2k-1)</code>
for k = 1, 2, 3, …<br />
Only odd harmonics contribute.
</p>
</div>
<div class="info-box">
<h4>What you're seeing</h4>
Each circle spins at a harmonic frequency. Their combined tip traces the target wave on
the right. Add more harmonics for a sharper approximation.
</div>
</aside>
</div>
<footer>
<p><a href="../../index.html">← Back to all experiments</a></p>
</footer>
<script src="../../js/experiments-basic-fourier.js"></script>
</body>
</html>