From e0b6eff1b9d5bfb202abbcfb369b2a0e06ef889f Mon Sep 17 00:00:00 2001 From: "daivid.alves" Date: Thu, 17 Oct 2024 18:15:10 -0300 Subject: [PATCH] =?UTF-8?q?Atualiza=C3=A7=C3=A3o=208=20-=20aplica=C3=A7?= =?UTF-8?q?=C3=A3o=20da=20tela=20de=20load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/Ambiente/Estrutura/load.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/js/Ambiente/Estrutura/load.js b/js/Ambiente/Estrutura/load.js index cc96c6e..4b02b47 100644 --- a/js/Ambiente/Estrutura/load.js +++ b/js/Ambiente/Estrutura/load.js @@ -11,7 +11,13 @@ function verificarAmbiente() { } elemento_2 = ''; - tela_laod.innerHTML = '

' + elemento_1 + '

' + elemento_2 + '
'; + tela_laod.innerHTML = '

' + elemento_1 + '

' + elemento_2 + '
'; + + // Inicia a animação após configurar o canvas + iniciarAnimacao(); + + // Inicia a contagem para limpar a tela após 3 segundos + finalizar(); } function finalizar() { @@ -21,14 +27,6 @@ function finalizar() { }, 3000); } -window.addEventListener('DOMContentLoaded', iniciarAnimacao) - -window.addEventListener('load', () => { - finalizar(); -}); - - - function iniciarAnimacao() { const canvas = document.getElementById('animationCanvas'); const ctx = canvas.getContext('2d'); @@ -83,4 +81,7 @@ function iniciarAnimacao() { circle.centerX = canvas.width / 2; circle.centerY = canvas.height / 2; }); -} \ No newline at end of file +} + +// Executa verificarAmbiente apenas uma vez após o carregamento total da página +window.addEventListener('load', verificarAmbiente);