Spaces:
Sleeping
Sleeping
Update static/embed.js
Browse files- static/embed.js +6 -8
static/embed.js
CHANGED
|
@@ -24,14 +24,12 @@ Object.assign(el.style, {
|
|
| 24 |
const rate = d.ratePerSecond;
|
| 25 |
let last = performance.now();
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
}, 1000); // update every 250ms (~4 times per second)
|
| 34 |
-
|
| 35 |
}
|
| 36 |
|
| 37 |
requestAnimationFrame(tick);
|
|
|
|
| 24 |
const rate = d.ratePerSecond;
|
| 25 |
let last = performance.now();
|
| 26 |
|
| 27 |
+
function tick(now) {
|
| 28 |
+
const dt = (now - last) / 1000;
|
| 29 |
+
last = now;
|
| 30 |
+
debt += rate * dt;
|
| 31 |
+
el.textContent = "$" + Math.round(debt).toLocaleString();
|
| 32 |
+
requestAnimationFrame(tick);
|
|
|
|
|
|
|
| 33 |
}
|
| 34 |
|
| 35 |
requestAnimationFrame(tick);
|