From 971f1a74f45d8a2315927e6571f325251ee73a9f Mon Sep 17 00:00:00 2001 From: Jason Sturges Date: Thu, 29 Feb 2024 02:05:16 -0600 Subject: [PATCH] Animation frame update --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index fd73a3e..f0a6fe9 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ import { Moon } from "./src"; import { Julian } from "./src"; -setInterval(() => { +const update = () => { document.querySelector("#julianDay").innerHTML = Julian.fromDate().toFixed(10); document.querySelector("#lunarAge").innerHTML = Moon.lunarAge().toFixed(10); document.querySelector("#lunarAgePercent").innerHTML = Moon.lunarAgePercent().toFixed(10); @@ -11,4 +11,6 @@ setInterval(() => { document.querySelector("#lunarPhaseEmoji").innerHTML = Moon.lunarPhaseEmoji(); document.querySelector("#isWaxing").innerHTML = Moon.isWaxing(); document.querySelector("#isWaning").innerHTML = Moon.isWaning(); -}, 33); + requestAnimationFrame(update); +}; +update();