-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbypass.html
More file actions
82 lines (70 loc) · 2.76 KB
/
bypass.html
File metadata and controls
82 lines (70 loc) · 2.76 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>16 Pixel Random Gray Background</title>
<style>
/* CSS styles */
body {
/* Remove default margin and padding */
margin: 0;
padding: 0;
/* Hide any potential overflow scrollbars */
overflow: hidden;
}
#pixel-grid {
/* This container will hold our 16 pixels */
position: fixed;
top: 0;
left: 0;
width: 100vw; /* Use viewport width */
height: 100vh; /* Use viewport height */
/* Use CSS Grid to create a 4x4 layout */
display: grid;
grid-template-columns: repeat(4, 1fr); /* 4 columns of equal fraction */
grid-template-rows: repeat(4, 1fr); /* 4 rows of equal fraction */
/* Set the overall opacity of the grid container to 75% */
opacity: 0.1;
}
.pixel {
/* Each pixel will be a grid item */
width: 100%;
height: 100%;
/* Add a transition for a smoother color change effect */
transition: background-color 0.5s ease-in-out;
}
</style>
</head>
<body>
<!-- The container for our background pixels (will be populated by JavaScript) -->
<div id="pixel-grid"></div>
<script>
// JavaScript logic
const gridContainer = document.getElementById('pixel-grid');
const numberOfPixels = 16;
// 1. Create the 16 pixel divs and add them to the grid
for (let i = 0; i < numberOfPixels; i++) {
const pixel = document.createElement('div');
pixel.classList.add('pixel');
gridContainer.appendChild(pixel);
}
// 2. A function to set a random gray color for every pixel
function updatePixelColors() {
const pixels = document.querySelectorAll('.pixel');
pixels.forEach(pixel => {
// Generate a random number between 0 and 255
const randomGrayValue = Math.floor(Math.random() * 256);
// Create an rgb color string. For a shade of gray, red, green, and blue are the same.
const randomGrayColor = `rgb(${randomGrayValue}, ${randomGrayValue}, ${randomGrayValue})`;
// Apply the new color to the pixel
pixel.style.backgroundColor = randomGrayColor;
});
}
// 3. Run the function every 5000 milliseconds (5 seconds)
setInterval(updatePixelColors, 5000);
// 4. Set the initial colors when the page first loads
updatePixelColors();
</script>
</body>
</html>