Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
LetsWorkAround authored Aug 21, 2024
1 parent 3faff4c commit 26b546c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ <h3>레드판다스컴퍼니 주식회사 (Red Pandas Company)</h3>

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();
}
Expand Down Expand Up @@ -570,9 +570,13 @@ <h3>레드판다스컴퍼니 주식회사 (Red Pandas Company)</h3>
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);
}
Expand Down

0 comments on commit 26b546c

Please sign in to comment.