File size: 10,219 Bytes
9ca53a0
 
 
 
 
 
 
 
 
 
 
 
 
 
f7d7c6b
 
 
 
 
 
 
 
 
 
 
 
b144a96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9ca53a0
 
 
 
 
e6c08b3
 
9ca53a0
e6c08b3
 
9ca53a0
bfa7926
 
 
 
 
 
9ca53a0
 
e6c08b3
9ca53a0
e6c08b3
 
 
 
 
 
 
 
a046038
 
 
9ca53a0
 
 
e6c08b3
35b0dde
e6c08b3
9ca53a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e6c08b3
9ca53a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f7d7c6b
b144a96
f7d7c6b
 
 
9ca53a0
 
 
 
 
a046038
e6c08b3
 
9ca53a0
e6c08b3
9ca53a0
 
 
 
 
 
a046038
9ca53a0
 
 
 
bfa7926
9ca53a0
 
 
bfa7926
708d048
 
 
 
 
 
 
 
bfa7926
 
 
 
708d048
 
 
 
2f2b6a5
708d048
 
 
bfa7926
708d048
 
bfa7926
708d048
 
 
 
bfa7926
 
 
 
 
 
 
708d048
 
 
 
 
 
 
 
 
 
 
bfa7926
 
 
 
 
 
708d048
bfa7926
 
708d048
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a55762e
708d048
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bfa7926
708d048
 
 
 
 
bfa7926
708d048
bfa7926
 
708d048
9ca53a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e6c08b3
9ca53a0
 
 
 
 
 
 
bfa7926
9ca53a0
 
 
bfa7926
9ca53a0
 
 
708d048
 
 
bfa7926
 
9ca53a0
 
 
bfa7926
9ca53a0
 
 
 
 
 
 
 
bfa7926
9ca53a0
 
 
 
bfa7926
9ca53a0
 
 
 
708d048
 
 
 
9ca53a0
bfa7926
9ca53a0
 
 
bfa7926
9ca53a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>XQ Thối</title>
  <style>
    html, body {
      margin: 0;
      padding: 0;
      overflow: hidden;
      height: 100vh;
      width: 100vw;
      font-family: 'Arial Rounded MT Bold', sans-serif;
      position: relative;
    }
    
    /* Video nền cho body */
    #body-video-bg {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      z-index: -2;
      will-change: transform;
      transform: translateZ(0);
      backface-visibility: hidden;
    }
    
    /* Màu nền dự phòng khi video đang load */
    body::before {
      content: '';
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: linear-gradient(to bottom right, #000000, #222222);
      z-index: -3;
    }

    /* Khung chữ */
    .container {
      position: absolute;
      border: 5px solid #8B4513;
      padding: 40px;
      border-radius: 20px;
      background-color: rgba(255, 255, 255, 0.3);
      box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
      overflow: hidden;
      cursor: grab;
      user-select: none;
    }
    
    .container:active {
      cursor: grabbing;
    }

    /* Video nền cho container */
    .video-background {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      z-index: -1;
      border-radius: 15px;
      will-change: transform;
      transform: translateZ(0);
      backface-visibility: hidden;
    }

    h1 {
      font-size: 6rem;
      color: #000000;
      text-shadow: 0 0 25px #d2b48c, 0 0 40px #8B4513;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 20px;
      margin: 0;
      position: relative;
      z-index: 1;
    }

    .letter {
      display: inline-block;
      animation: floaty 3s ease-in-out infinite;
    }

    @keyframes floaty {
      0%   { transform: translateY(0) rotate(0deg); }
      25%  { transform: translateY(-8px) rotate(1deg); }
      50%  { transform: translateY(0) rotate(0deg); }
      75%  { transform: translateY(8px) rotate(-1deg); }
      100% { transform: translateY(0) rotate(0deg); }
    }

    .emoji {
      position: absolute;
      font-size: 26px;
      animation: pop 1s ease-out forwards;
      color: #8B4513;
      pointer-events: none;
    }

    @keyframes pop {
      0% { transform: scale(1); opacity: 1; }
      100% { transform: scale(2); opacity: 0; top: -40px; }
    }

    .spider {
      position: absolute;
      font-size: 40px;
      pointer-events: none;
      transition: transform 0.1s linear;
    }

    .baby-spider {
      position: absolute;
      font-size: 20px;
      pointer-events: none;
      transition: transform 0.1s linear;
    }

    /* Khung hoa văn */
    .border-frame {
      position: absolute;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      background-image: url('https://www.transparenttextures.com/patterns/circuit-board.png');
      background-size: cover;
      z-index: -1;
    }
  </style>
</head>
<body>

<!-- Video nền toàn màn hình -->
<video id="body-video-bg" autoplay loop muted playsinline preload="auto" loading="eager">
  <source src="Background.mp4" type="video/mp4">
</video>

<!-- Khung hoa văn -->
<div class="border-frame"></div>

<!-- Khung chữ với nội dung -->
<div class="container">
  <video class="video-background" autoplay loop muted playsinline preload="auto" loading="eager">
    <source src="video.mp4" type="video/mp4">
  </video>
  <h1>
    <span class="letter">emem</span>
    <span class="letter">XQ</span>
    <span class="letter">💗</span>
  </h1>
</div>

<div id="spider" class="spider">💗</div>
<audio id="bg-music" src="music.mp3" preload="auto"></audio>

<script>
  const spider = document.getElementById('spider');
  const music = document.getElementById('bg-music');
  const container = document.querySelector('.container');
  let mouseX = window.innerWidth / 2;
  let mouseY = window.innerHeight / 2;
  let spiderX = mouseX, spiderY = mouseY;
  
  // Vật lý cho container
  let containerX = window.innerWidth / 2;
  let containerY = window.innerHeight / 2;
  let containerVelX = 0;
  let containerVelY = 0;
  let isDragging = false;
  let dragOffsetX = 0;
  let dragOffsetY = 0;
  const friction = 0.95;
  const elasticity = 0.7;
  const wallMargin = 50;
  
  // Khởi tạo vị trí ban đầu
  container.style.left = containerX + 'px';
  container.style.top = containerY + 'px';
  container.style.transform = 'translate(-50%, -50%)';

  // Xử lý kéo thả container
  container.addEventListener('mousedown', startDrag);
  container.addEventListener('touchstart', startDrag);
  
  function startDrag(e) {
    isDragging = true;
    const touch = e.type === 'touchstart' ? e.touches[0] : e;
    dragOffsetX = touch.clientX - containerX;
    dragOffsetY = touch.clientY - containerY;
    containerVelX = 0;
    containerVelY = 0;
    e.preventDefault();
  }
  
  document.addEventListener('mousemove', drag);
  document.addEventListener('touchmove', drag);
  
  function drag(e) {
    if (isDragging) {
      const touch = e.type === 'touchmove' ? e.touches[0] : e;
      const newX = touch.clientX - dragOffsetX;
      const newY = touch.clientY - dragOffsetY;
      
      containerVelX = (newX - containerX) * 0.5;
      containerVelY = (newY - containerY) * 0.5;
      
      containerX = newX;
      containerY = newY;
    }
  }
  
  document.addEventListener('mouseup', stopDrag);
  document.addEventListener('touchend', stopDrag);
  
  function stopDrag() {
    isDragging = false;
  }
  
  // Cập nhật vật lý container
  function updateContainerPhysics() {
    if (!isDragging) {
      // Áp dụng ma sát
      containerVelX *= friction;
      containerVelY *= friction;
      
      // Cập nhật vị trí
      containerX += containerVelX;
      containerY += containerVelY;
      
      // Kiểm tra va chạm với tường
      const rect = container.getBoundingClientRect();
      const halfWidth = rect.width / 2;
      const halfHeight = rect.height / 2;
      
      // Tường trái
      if (containerX - halfWidth < wallMargin) {
        containerX = wallMargin + halfWidth;
        containerVelX = Math.abs(containerVelX) * elasticity;
      }
      // Tường phải
      if (containerX + halfWidth > window.innerWidth - wallMargin) {
        containerX = window.innerWidth - wallMargin - halfWidth;
        containerVelX = -Math.abs(containerVelX) * elasticity;
      }
      // Tường trên
      if (containerY - halfHeight < wallMargin) {
        containerY = wallMargin + halfHeight;
        containerVelY = Math.abs(containerVelY) * elasticity;
      }
      // Tường dưới
      if (containerY + halfHeight > window.innerHeight - wallMargin) {
        containerY = window.innerHeight - wallMargin - halfHeight;
        containerVelY = -Math.abs(containerVelY) * elasticity;
      }
    }
    
    // Cập nhật vị trí DOM
    container.style.left = containerX + 'px';
    container.style.top = containerY + 'px';
    
    requestAnimationFrame(updateContainerPhysics);
  }
  
  updateContainerPhysics();

  // Nhện con (ở các góc màn hình)
  const babySpiders = [
    { x: 0, y: 0, speed: 0.02 },
    { x: window.innerWidth, y: 0, speed: 0.03 },
    { x: 0, y: window.innerHeight, speed: 0.04 },
    { x: window.innerWidth, y: window.innerHeight, speed: 0.05 }
  ];

  // Tạo nhện con ở các góc
  babySpiders.forEach(spiderData => {
    const babySpider = document.createElement('div');
    babySpider.className = 'baby-spider';
    babySpider.innerText = '💗';
    document.body.appendChild(babySpider);
    moveSpiderToCursor(babySpider, spiderData.x, spiderData.y, spiderData.speed);
  });

  // Di chuyển nhện con về vị trí của chuột
  function moveSpiderToCursor(spiderElement, x, y, speed) {
    let targetX = x;
    let targetY = y;
    function move() {
      const dx = mouseX - targetX;
      const dy = mouseY - targetY;
      targetX += dx * speed;
      targetY += dy * speed;
      spiderElement.style.transform = `translate(${targetX}px, ${targetY}px)`;
      requestAnimationFrame(move);
    }
    move();
  }

  // Hàm random chọn emoji
  function getRandomEmoji() {
    const emojis = ['💗', '💗', '♥'];
    return emojis[Math.floor(Math.random() * emojis.length)];
  }

  // Hàm tạo emoji ngẫu nhiên
  function createEmoji(x, y) {
    const emoji = document.createElement('div');
    emoji.className = 'emoji';
    emoji.innerText = getRandomEmoji();
    emoji.style.left = `${x}px`;
    emoji.style.top = `${y}px`;
    document.body.appendChild(emoji);
    setTimeout(() => emoji.remove(), 1000);
  }

  document.addEventListener('mousemove', (e) => {
    if (!isDragging) {
      mouseX = e.clientX;
      mouseY = e.clientY;
      createEmoji(e.clientX, e.clientY);
    }
  });

  document.addEventListener('click', (e) => {
    createEmoji(e.clientX, e.clientY);
    spiderX = e.clientX;
    spiderY = e.clientY;
  });

  document.addEventListener('touchmove', (e) => {
    const touch = e.touches[0];
    mouseX = touch.clientX;
    mouseY = touch.clientY;
    createEmoji(mouseX, mouseY);
  });

  document.addEventListener('touchstart', (e) => {
    const touch = e.touches[0];
    createEmoji(touch.clientX, touch.clientY);
    spiderX = touch.clientX;
    spiderY = touch.clientY;
  });

  // Bỏ qua block autoplay của trình duyệt
  document.addEventListener('click', () => {
    music.play();
  }, { once: true });

  // Di chuyển nhện lớn
  function moveSpider() {
    const dx = mouseX - spiderX;
    const dy = mouseY - spiderY;
    spiderX += dx * 0.2;
    spiderY += dy * 0.2;
    spider.style.transform = `translate(${spiderX}px, ${spiderY}px)`;

    if (Math.abs(dx) < 1 && Math.abs(dy) < 1) {
      spiderX = window.innerWidth / 2;
      spiderY = window.innerHeight / 2;
    }

    requestAnimationFrame(moveSpider);
  }

  moveSpider();
</script>
</body>
</html>