Skip to content

Commit

Permalink
add the chaotic effect
Browse files Browse the repository at this point in the history
  • Loading branch information
MuKulsoop committed Oct 21, 2024
1 parent d57a2a8 commit ed98566
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions chaosweb-v@2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,28 @@
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
<script>
// The base title that should not fully change
const titleText = "Chaotic Title!";
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()";

// Function to randomize certain characters only
function randomizeTitle() {
let chaoticTitle = '';
for (let i = 0; i < titleText.length; i++) {
// Randomize only certain characters, while leaving others untouched
if (titleText[i] !== ' ' && Math.random() > 0.7) { // Adjust randomness threshold here (0.7)
chaoticTitle += characters.charAt(Math.floor(Math.random() * characters.length));
} else {
chaoticTitle += titleText[i]; // Keep the original character
}
}
// Set the new title in the document
document.title = chaoticTitle;
}

// Update the title every 500 milliseconds
setInterval(randomizeTitle, 500);
</script>
</body>
</html>

0 comments on commit ed98566

Please sign in to comment.