-
Notifications
You must be signed in to change notification settings - Fork 0
/
bruh.html
69 lines (61 loc) · 2.24 KB
/
bruh.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flying Buttons</title>
<style>
body {
margin: 10;
overflow: hidden;
}
button {
position: absolute;
width: 50px;
height: 30px;
background-color: black;
color: #f00;
border: none;
cursor: pointer;
}
</style>
</head>
<body>
<button id="spawnButton">Click</button>
<script>
document.getElementById("spawnButton").addEventListener("click", function () {
for (let i = 0; i < 20000; i++) {
const button = document.createElement("button");
button.innerText = "Bruh";
document.body.appendChild(button);
// Randomize button position
const maxX = window.innerWidth - 50;
const maxY = window.innerHeight - 30;
const randomX = Math.random() * maxX;
const randomY = Math.random() * maxY;
button.style.left = randomX + "px";
button.style.top = randomY + "px";
// Randomize button movement
const speedX = (Math.random() - 0.6) * 10;
const speedY = (Math.random() - 0.5) * 10;
function animateButton() {
const currentX = parseFloat(button.style.left);
const currentY = parseFloat(button.style.top);
const newX = currentX + speedX;
const newY = currentY + speedY;
if (newX < 0 || newX > maxX || newY < 0 || newY > maxY) {
// Remove the button when it goes out of bounds
document.body.removeChild(button);
} else {
button.style.left = newX + "px";
button.style.top = newY + "px";
requestAnimationFrame(animateButton);
}
}
// Start the animation
requestAnimationFrame(animateButton);
}
});
</script>
</body>
</html>