-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
112 lines (105 loc) · 3.66 KB
/
index.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DVD Bouncing Logo</title>
<style>
body {
margin: 0;
overflow: hidden;
background-color: #000;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
color: white;
font-family: Arial, sans-serif;
}
.dvd {
position: absolute;
width: 300px; /* Size set to 300px x 100px */
height: 100px; /* Size set to 300px x 100px */
background-size: contain;
background-repeat: no-repeat;
}
#redirectMessage {
position: absolute;
bottom: 20px;
font-size: 20px;
font-weight: bold;
}
.hidden {
display: none;
}
.input-container {
position: absolute;
top: -100px; /* Hide input off-screen */
left: -100px; /* Hide input off-screen */
}
.input-container input {
font-size: 18px;
padding: 5px;
}
</style>
</head>
<body>
<div class="dvd" id="dvd"></div>
<div class="input-container">
<input type="text" id="userInput" placeholder="Type 'dvd' here">
</div>
<div id="redirectMessage" class="hidden"></div>
<script>
const dvd = document.getElementById('dvd');
const dvdImages = [
'dvdPNG/dvd1.png',
'dvdPNG/dvd2.png',
'dvdPNG/dvd3.png',
'dvdPNG/dvd4.png',
'dvdPNG/dvd5.png'
];
let currentImageIndex = 0;
dvd.style.backgroundImage = `url(${dvdImages[currentImageIndex]})`;
let x = Math.random() * (window.innerWidth - dvd.clientWidth);
let y = Math.random() * (window.innerHeight - dvd.clientHeight);
let dx = 2;
let dy = 2;
function changeImage() {
currentImageIndex = (currentImageIndex + 1) % dvdImages.length;
dvd.style.backgroundImage = `url(${dvdImages[currentImageIndex]})`;
}
function animate() {
if (x + dvd.clientWidth > window.innerWidth || x < 0) {
dx = -dx;
x = Math.max(0, Math.min(x, window.innerWidth - dvd.clientWidth));
changeImage();
}
if (y + dvd.clientHeight > window.innerHeight || y < 0) {
dy = -dy;
y = Math.max(0, Math.min(y, window.innerHeight - dvd.clientHeight));
changeImage();
}
x += dx;
y += dy;
dvd.style.left = `${x}px`;
dvd.style.top = `${y}px`;
requestAnimationFrame(animate);
}
animate();
function checkInput() {
const userInput = document.getElementById('userInput').value.trim().toLowerCase();
if (userInput === 'dvd') {
document.getElementById('redirectMessage').textContent = 'Loading Web Video Player...';
document.getElementById('redirectMessage').classList.remove('hidden');
setTimeout(() => {
window.location.href = '/DVD/VideoPlayer/index.html';
}, 2000); // Delay redirect for 2 seconds to display the message
}
}
document.getElementById('userInput').addEventListener('input', checkInput);
document.getElementById('userInput').focus(); // Ensure input field is focused
</script>
</body>
</html>