|
17 | 17 | x4;y4
|
18 | 18 | "
|
19 | 19 | >
|
20 |
| --3.24;0.8 |
21 |
| --0.88;3.77 |
22 |
| -1.5;3.47 |
23 |
| -2.6;5.66 |
24 |
| -4.15;7.86 |
25 |
| -5.7;8.02 |
26 |
| -7.52;9.75 |
| 20 | + -3.24;0.8 |
| 21 | + -0.88;3.77 |
| 22 | + 1.5;3.47 |
| 23 | + 5.7;8.02 |
| 24 | + 7.52;9.75 |
27 | 25 | </textarea
|
28 | 26 | >
|
29 |
| - <!-- |
30 |
| -8.44;11.46 |
31 |
| -9.63;11.15 |
32 |
| -10.58;12.63 |
33 |
| -11.54;14.74 |
34 |
| -12.7;12.86 --> |
35 |
| - <button id="interpolateButton">Interpolate!</button> |
36 |
| - <button id="stopButton">Stoooooop!</button> |
| 27 | + <div style="display: flex; flex-direction: column; gap: 20px; width: 200px"> |
| 28 | + <button id="interpolateButton">Interpolate!</button> |
| 29 | + <button id="stopButton">Stoooooop!</button> |
| 30 | + <label>Lower bound:</label> |
| 31 | + <div style="display: flex; justify-content: space-between; align-items: center"> |
| 32 | + <input type="range" step="0.1" min="-10" max="0" value="-10" id="lowerSlider" /> |
| 33 | + <strong id="lowerView" style>-10</strong> |
| 34 | + </div> |
| 35 | + <label>Upper bound:</label> |
| 36 | + <div style="display: flex; justify-content: space-between; align-items: center"> |
| 37 | + <input type="range" step="0.1" min="0" max="10" value="10" id="upperSlider" /> |
| 38 | + <strong id="upperView" style>10</strong> |
| 39 | + </div> |
| 40 | + </div> |
37 | 41 | </div>
|
38 | 42 |
|
39 |
| - <canvas id="wasmCanvas" width="2000px" height="2000px"></canvas> |
| 43 | + <canvas id="wasmCanvas" width="1000px" height="1000px" style="border: black solid 1px"></canvas> |
40 | 44 |
|
41 | 45 | <script type="module">
|
42 | 46 | import { getLameWasmEnv, lamePostInit } from "../../../lib/lamelib.js";
|
|
77 | 81 | }
|
78 | 82 |
|
79 | 83 | const FF_SCALE = 1000;
|
80 |
| - const LOWER_BOUND = -4; |
81 |
| - const UPPER_BOUND = 10; |
| 84 | + let lowerBound = -10; |
| 85 | + let upperBound = 10; |
82 | 86 | const MILLISECONDS_IN_SECOND = 1000;
|
83 | 87 |
|
84 | 88 | let stop = false;
|
85 | 89 | let start;
|
86 | 90 | let previous;
|
87 |
| - const MAX_STEPS = 1000; |
| 91 | + const MAX_STEPS = 2000; |
88 | 92 | let steps = MAX_STEPS;
|
89 | 93 |
|
90 | 94 | function next(timestamp) {
|
|
100 | 104 |
|
101 | 105 | const ts = (timestamp - start) / MILLISECONDS_IN_SECOND; // second == 1 on x-axis
|
102 | 106 | console.log(ts);
|
103 |
| - if (ts > UPPER_BOUND) { |
| 107 | + if (ts > upperBound) { |
104 | 108 | console.log("Reached upper bound");
|
105 | 109 | return;
|
106 | 110 | }
|
|
122 | 126 | }
|
123 | 127 |
|
124 | 128 | function interpolate() {
|
| 129 | + stop = false; |
125 | 130 | steps = MAX_STEPS;
|
126 | 131 | ctx.clearRect(0, 0, 1000, 1000);
|
127 | 132 | window.requestAnimationFrame((timestamp) => {
|
128 |
| - start = timestamp - LOWER_BOUND * MILLISECONDS_IN_SECOND; |
| 133 | + start = timestamp - lowerBound * MILLISECONDS_IN_SECOND; |
129 | 134 | window.requestAnimationFrame(next);
|
130 | 135 | });
|
131 | 136 | }
|
|
135 | 140 | document.getElementById("stopButton").addEventListener("click", () => {
|
136 | 141 | stop = true;
|
137 | 142 | });
|
| 143 | + |
| 144 | + const lowerView = document.getElementById("lowerView"); |
| 145 | + document.getElementById("lowerSlider").addEventListener("input", (event) => { |
| 146 | + console.log(event.target.value); |
| 147 | + lowerBound = event.target.value; |
| 148 | + lowerView.innerHTML = lowerBound; |
| 149 | + }); |
| 150 | + |
| 151 | + document.getElementById("upperSlider").addEventListener("input", (event) => { |
| 152 | + upperBound = event.target.value; |
| 153 | + upperView.innerHTML = upperBound; |
| 154 | + }); |
138 | 155 | </script>
|
139 | 156 | </body>
|
140 | 157 | </html>
|
0 commit comments