From 26b546c0728119eea49c7bca55b90a0a5582c65b Mon Sep 17 00:00:00 2001
From: WebMoneyMaker <103347453+LetsWorkAround@users.noreply.github.com>
Date: Wed, 21 Aug 2024 18:08:47 +0900
Subject: [PATCH] Update index.html
---
index.html | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/index.html b/index.html
index 1985420..1283e3a 100644
--- a/index.html
+++ b/index.html
@@ -515,7 +515,7 @@
레드판다스컴퍼니 주식회사 (Red Pandas Company)
function updateData() {
const newTime = data[data.length - 1].time + 1;
- const newValues = data[data.length - 1].values.map(v => Math.max(-50, Math.min(50, v + (Math.random() - 0.5) * 2)));
+ const newValues = data[data.length - 1].values.map(v => Math.max(-20, Math.min(20, v + (Math.random() - 0.5) * 2)));
data.push({ time: newTime, values: newValues });
if (data.length > dataPoints) data.shift();
}
@@ -570,9 +570,13 @@ 레드판다스컴퍼니 주식회사 (Red Pandas Company)
ctx.fillText(fund, width - 80, 32 + index * 20);
});
}
-
- function animate() {
- updateData();
+
+ const updateInterval = 200; // 200ms마다 데이터 업데이트
+ function animate(currentTime) {
+ if (currentTime - lastUpdateTime > updateInterval) {
+ updateData();
+ lastUpdateTime = currentTime;
+ }
drawGraph();
requestAnimationFrame(animate);
}