Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added preloader #129

Merged
merged 4 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,32 @@
</head>

<body>

<div class="loader">
<div>
<lottie-player src="https://lottie.host/451aadfb-9af8-4298-98be-e9c583f8a72c/jPRsrfR2jf.json" background="##FFFFFF" speed="1" style="width: 300px; height: 300px" loop autoplay mode="normal"></lottie-player>

</div>

</div>
<div class="snowflakes">
<!-- Generate snowflakes dynamically with JavaScript -->
</div>
<div id="particles-js"></div>
<div class="container">
<div class="background">
<div class="shape"></div>
<div class="shape"></div>
</div>
<div class="box">
<h1 id="changingHeading" style="font-family: 'Cinzel', serif; font-size: 39px; color: #ffffff;">
Random Disco
<span id="changing" style="font-family: 'Cinzel', serif; font-size: 39px; font-weight: bold; color: #ff7f50;">
Light Simulator
</span>
</h1>
</div>
<div class="unload">

<div id="particles-js"></div>
<div class="container">
<div class="background">
<div class="shape"></div>
<div class="shape"></div>
</div>
<div class="box">
<h1 id="changingHeading" style="font-family: Arial, sans-serif; font-size: 39px; color: #ffffff;">
Random Disco
<span id="changing" style="font-family: Arial, sans-serif; font-size: 39px; font-weight: bold; color: #ff7f50;">
Light Simulator
</span>
</h1>
<header>
<div class="header-content">
<nav>
Expand Down Expand Up @@ -258,7 +268,9 @@ <h1>Linear Mode</h1>
transforming your space into a dynamic disco.
</p>
</div>
</div>
</div>
</body>
<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>
</html>


</html>
21 changes: 18 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,16 @@ document.addEventListener('DOMContentLoaded', () => {

const timeInput = document.getElementById('time');

const randomTimeInterval = Math.floor(Math.random() * 5000) + 1000;
timeInput.value = randomTimeInterval;
const unitSelect = document.getElementById('unit');
const randomUnitIndex = Math.random() < 0.5 ? 1 : 2;
if (randomUnitIndex == 1) {
var randomTimeInterval = Math.floor(Math.random() * 1000) + 1;
randomTimeInterval = Math.floor(Math.random() * 1000) + 1;
timeInput.value = randomTimeInterval;
}
else {
var randomTimeInterval = Math.floor(Math.random() * 10) + 1;
randomTimeInterval = Math.floor(Math.random() * 10) + 1;
timeInput.value = randomTimeInterval;
}
unitSelect.selectedIndex = randomUnitIndex;
Expand Down Expand Up @@ -371,4 +373,17 @@ document.getElementById('submit').addEventListener('click', function () {
document.getElementById(selectedMusic).play();
}
});
});
});

function effect(){
loader.style.display="none";
document.querySelector(".unload").style.display="block";
document.querySelector(".snowflakes").style.display="block";
}



var loader=document.querySelector(".loader");
window.addEventListener('load',()=>{
let timout=setTimeout(effect,4000);
})
14 changes: 14 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ body {
font-family: 'Playfair Display', serif;
}


.unload{
display: none;
}

.loader{
display: flex;
align-items: center;
justify-content: center;
width: 100vw;
height: 100vh;
}


#particles-js {
position: absolute;
width: 100%;
Expand Down
Loading