SAIcgr commited on
Commit
856ebb1
·
verified ·
1 Parent(s): 94bdbfa

Upload 7 files

Browse files
Files changed (6) hide show
  1. Pong Game.html +253 -0
  2. gt.html +231 -0
  3. hong-game.html +253 -0
  4. index - Copy.html +153 -0
  5. media-pipe-pong.html +84 -0
  6. mk.html +243 -0
Pong Game.html ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Pong Game with Speed Control</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands.js"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/@mediapipe/drawing_utils/drawing_utils.js"></script>
10
+ <style>
11
+ * {
12
+ margin: 0;
13
+ padding: 0;
14
+ box-sizing: border-box;
15
+ }
16
+
17
+ body {
18
+ font-family: Arial, sans-serif;
19
+ background: linear-gradient(135deg, #74ebd5, #acb6e5);
20
+ color: white;
21
+ display: flex;
22
+ flex-direction: column;
23
+ justify-content: center;
24
+ align-items: center;
25
+ height: 100vh;
26
+ overflow: hidden;
27
+ }
28
+
29
+ .header {
30
+ width: 100%;
31
+ background-color: rgba(0, 0, 0, 0.7);
32
+ padding: 10px 0;
33
+ text-align: center;
34
+ position: fixed;
35
+ top: 0;
36
+ z-index: 100;
37
+ display: flex;
38
+ justify-content: space-between;
39
+ align-items: center;
40
+ padding: 0 20px;
41
+ box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
42
+ }
43
+
44
+ .header div {
45
+ color: white;
46
+ font-size: 18px;
47
+ font-weight: bold;
48
+ }
49
+
50
+ .game-container {
51
+ display: flex;
52
+ flex-direction: column;
53
+ align-items: center;
54
+ justify-content: center;
55
+ width: 100%;
56
+ height: 100%;
57
+ padding-top: 70px; /* Space for the header */
58
+ }
59
+
60
+ canvas {
61
+ border: 2px solid #fff;
62
+ border-radius: 10px;
63
+ background: #222;
64
+ max-width: 90%;
65
+ max-height: 70%;
66
+ width: auto;
67
+ height: auto;
68
+ }
69
+
70
+ .controls {
71
+ margin-top: 10px;
72
+ display: flex;
73
+ align-items: center;
74
+ gap: 10px;
75
+ }
76
+
77
+ .controls label {
78
+ font-size: 16px;
79
+ }
80
+
81
+ .controls input[type="range"] {
82
+ width: 150px;
83
+ }
84
+
85
+ video {
86
+ display: none;
87
+ }
88
+ </style>
89
+ </head>
90
+ <body>
91
+ <div class="header">
92
+ <div id="score">Score: 0</div>
93
+ <div id="timer">Time: 60</div>
94
+ </div>
95
+
96
+ <div class="game-container">
97
+ <canvas id="gameCanvas" width="500" height="500"></canvas>
98
+ <div class="controls">
99
+ <label for="speedControl">Ball Speed:</label>
100
+ <input type="range" id="speedControl" min="1" max="10" value="2" step="1">
101
+ </div>
102
+ </div>
103
+
104
+ <video id="webcam" autoplay playsinline></video>
105
+
106
+ <script>
107
+ const canvas = document.getElementById('gameCanvas');
108
+ const ctx = canvas.getContext('2d');
109
+ const scoreDisplay = document.getElementById('score');
110
+ const timerDisplay = document.getElementById('timer');
111
+ const speedControl = document.getElementById('speedControl');
112
+
113
+ let ball = {
114
+ x: canvas.width / 2,
115
+ y: canvas.height / 2,
116
+ radius: 10,
117
+ dx: 2,
118
+ dy: 2,
119
+ color: 'white',
120
+ };
121
+
122
+ let paddle = {
123
+ x: canvas.width / 2 - 50,
124
+ y: canvas.height - 20,
125
+ width: 100,
126
+ height: 10,
127
+ color: 'white',
128
+ };
129
+
130
+ let score = 0;
131
+ let timeLeft = 60;
132
+
133
+ // Update ball speed based on slider
134
+ speedControl.addEventListener('input', () => {
135
+ const speed = parseInt(speedControl.value);
136
+ ball.dx = Math.sign(ball.dx) * speed;
137
+ ball.dy = Math.sign(ball.dy) * speed;
138
+ });
139
+
140
+ // Draw ball
141
+ function drawBall() {
142
+ ctx.beginPath();
143
+ ctx.arc(ball.x, ball.y, ball.radius, 0, Math.PI * 2);
144
+ ctx.fillStyle = ball.color;
145
+ ctx.fill();
146
+ ctx.closePath();
147
+ }
148
+
149
+ // Draw paddle
150
+ function drawPaddle() {
151
+ ctx.fillStyle = paddle.color;
152
+ ctx.fillRect(paddle.x, paddle.y, paddle.width, paddle.height);
153
+ }
154
+
155
+ // Update ball position
156
+ function updateBall() {
157
+ ball.x += ball.dx;
158
+ ball.y += ball.dy;
159
+
160
+ // Bounce off walls
161
+ if (ball.x + ball.radius > canvas.width || ball.x - ball.radius < 0) {
162
+ ball.dx = -ball.dx;
163
+ }
164
+ if (ball.y - ball.radius < 0) {
165
+ ball.dy = -ball.dy;
166
+ }
167
+
168
+ // Bounce off paddle
169
+ if (
170
+ ball.y + ball.radius > paddle.y &&
171
+ ball.x > paddle.x &&
172
+ ball.x < paddle.x + paddle.width
173
+ ) {
174
+ ball.dy = -ball.dy;
175
+ score++;
176
+ }
177
+
178
+ // Reset if ball hits the bottom
179
+ if (ball.y + ball.radius > canvas.height) {
180
+ score = 0;
181
+ ball.x = canvas.width / 2;
182
+ ball.y = canvas.height / 2;
183
+ ball.dx = Math.sign(ball.dx) * parseInt(speedControl.value);
184
+ ball.dy = Math.sign(ball.dy) * parseInt(speedControl.value);
185
+ }
186
+
187
+ scoreDisplay.textContent = `Score: ${score}`;
188
+ }
189
+
190
+ // Timer
191
+ function startTimer() {
192
+ const timerInterval = setInterval(() => {
193
+ if (timeLeft > 0) {
194
+ timeLeft--;
195
+ timerDisplay.textContent = `Time: ${timeLeft}`;
196
+ } else {
197
+ clearInterval(timerInterval);
198
+ alert(`Game Over! Your score is ${score}`);
199
+ document.location.reload();
200
+ }
201
+ }, 1000);
202
+ }
203
+
204
+ // Game loop
205
+ function gameLoop() {
206
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
207
+ drawBall();
208
+ drawPaddle();
209
+ updateBall();
210
+ requestAnimationFrame(gameLoop);
211
+ }
212
+
213
+ // MediaPipe Hands setup
214
+ const hands = new Hands({
215
+ locateFile: (file) => `https://cdn.jsdelivr.net/npm/@mediapipe/hands/${file}`,
216
+ });
217
+
218
+ hands.setOptions({
219
+ maxNumHands: 1,
220
+ modelComplexity: 1,
221
+ minDetectionConfidence: 0.7,
222
+ minTrackingConfidence: 0.7,
223
+ });
224
+
225
+ const videoElement = document.getElementById('webcam');
226
+ const camera = new Camera(videoElement, {
227
+ onFrame: async () => {
228
+ await hands.send({ image: videoElement });
229
+ },
230
+ width: 640,
231
+ height: 480,
232
+ });
233
+ camera.start();
234
+
235
+ hands.onResults((results) => {
236
+ if (results.multiHandLandmarks && results.multiHandLandmarks.length > 0) {
237
+ const landmarks = results.multiHandLandmarks[0];
238
+ const indexFinger = landmarks[8]; // Index finger tip
239
+
240
+ // Map index finger x-coordinate to paddle position
241
+ paddle.x = indexFinger.x * canvas.width - paddle.width / 2;
242
+
243
+ // Ensure paddle stays within canvas bounds
244
+ if (paddle.x < 0) paddle.x = 0;
245
+ if (paddle.x + paddle.width > canvas.width) paddle.x = canvas.width - paddle.width;
246
+ }
247
+ });
248
+
249
+ startTimer();
250
+ gameLoop();
251
+ </script>
252
+ </body>
253
+ </html>
gt.html ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Snake Game</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands.js"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/@mediapipe/drawing_utils/drawing_utils.js"></script>
10
+ <style>
11
+ * {
12
+ margin: 0;
13
+ padding: 0;
14
+ box-sizing: border-box;
15
+ }
16
+ body {
17
+ font-family: Arial, sans-serif;
18
+ background-color: black;
19
+ color: white;
20
+ display: flex;
21
+ flex-direction: column;
22
+ align-items: center;
23
+ justify-content: center;
24
+ height: 100vh;
25
+ overflow: hidden;
26
+ }
27
+ .game-container {
28
+ position: relative;
29
+ width: 90%;
30
+ max-width: 600px;
31
+ aspect-ratio: 3 / 2;
32
+ background-color: #111;
33
+ border: 2px solid #00ff00;
34
+ display: flex;
35
+ justify-content: center;
36
+ align-items: center;
37
+ }
38
+ canvas {
39
+ position: absolute;
40
+ top: 0;
41
+ left: 0;
42
+ width: 100%;
43
+ height: 100%;
44
+ }
45
+ #pointer {
46
+ position: absolute;
47
+ width: 15px;
48
+ height: 15px;
49
+ background-color: rgba(255, 0, 0, 0.8);
50
+ border-radius: 50%;
51
+ pointer-events: none;
52
+ transform: translate(-50%, -50%);
53
+ }
54
+ .timer {
55
+ position: fixed;
56
+ top: 10px;
57
+ left: 10px;
58
+ font-size: 18px;
59
+ color: white;
60
+ z-index: 10;
61
+ }
62
+ .score {
63
+ position: fixed;
64
+ top: 10px;
65
+ right: 10px;
66
+ font-size: 18px;
67
+ color: white;
68
+ z-index: 10;
69
+ }
70
+ .popup {
71
+ position: fixed;
72
+ top: 50%;
73
+ left: 50%;
74
+ transform: translate(-50%, -50%);
75
+ background-color: #222;
76
+ color: white;
77
+ padding: 20px;
78
+ border: 2px solid #00ff00;
79
+ border-radius: 10px;
80
+ z-index: 10;
81
+ text-align: center;
82
+ }
83
+ .popup button {
84
+ margin-top: 10px;
85
+ padding: 10px 20px;
86
+ background-color: #00ff00;
87
+ border: none;
88
+ border-radius: 5px;
89
+ cursor: pointer;
90
+ color: black;
91
+ font-size: 16px;
92
+ }
93
+ .popup button:hover {
94
+ background-color: #00cc00;
95
+ }
96
+ </style>
97
+ </head>
98
+ <body>
99
+ <div class="timer" id="timer">Time: 0:00</div>
100
+ <div class="score" id="score">Score: 0</div>
101
+ <div class="game-container">
102
+ <canvas id="gameCanvas"></canvas>
103
+ <div id="pointer"></div>
104
+ </div>
105
+
106
+ <script>
107
+ const canvas = document.getElementById('gameCanvas');
108
+ const ctx = canvas.getContext('2d');
109
+ const pointer = document.getElementById('pointer');
110
+ const timerDisplay = document.getElementById('timer');
111
+ const scoreDisplay = document.getElementById('score');
112
+
113
+ canvas.width = canvas.parentElement.clientWidth;
114
+ canvas.height = canvas.parentElement.clientHeight;
115
+
116
+ let snake = [{ x: 150, y: 150 }];
117
+ const snakeSize = 20;
118
+ let food = { x: Math.random() * (canvas.width - snakeSize), y: Math.random() * (canvas.height - snakeSize) };
119
+ let score = 0;
120
+ let timeLeft = 60; // 1 minute
121
+ let gameInterval, timerInterval;
122
+
123
+ // Initialize MediaPipe Hands
124
+ const hands = new Hands({
125
+ locateFile: (file) => `https://cdn.jsdelivr.net/npm/@mediapipe/hands/${file}`,
126
+ });
127
+
128
+ hands.setOptions({
129
+ maxNumHands: 1,
130
+ modelComplexity: 1,
131
+ minDetectionConfidence: 0.8,
132
+ minTrackingConfidence: 0.8,
133
+ });
134
+
135
+ const videoElement = document.createElement('video');
136
+ const camera = new Camera(videoElement, {
137
+ onFrame: async () => {
138
+ await hands.send({ image: videoElement });
139
+ },
140
+ width: 1280,
141
+ height: 720,
142
+ });
143
+ camera.start();
144
+
145
+ hands.onResults((results) => {
146
+ if (results.multiHandLandmarks && results.multiHandLandmarks.length > 0) {
147
+ const landmarks = results.multiHandLandmarks[0];
148
+ const pointerX = landmarks[8].x * canvas.width;
149
+ const pointerY = landmarks[8].y * canvas.height;
150
+
151
+ pointer.style.left = `${pointerX}px`;
152
+ pointer.style.top = `${pointerY}px`;
153
+ }
154
+ });
155
+
156
+ function drawSnake() {
157
+ ctx.fillStyle = 'green';
158
+ snake.forEach((segment) => {
159
+ ctx.fillRect(segment.x, segment.y, snakeSize, snakeSize);
160
+ });
161
+ }
162
+
163
+ function drawFood() {
164
+ ctx.fillStyle = 'red';
165
+ ctx.fillRect(food.x, food.y, snakeSize, snakeSize);
166
+ }
167
+
168
+ function moveSnake() {
169
+ const head = { x: snake[0].x, y: snake[0].y };
170
+ head.x += (pointer.offsetLeft - head.x) * 0.1;
171
+ head.y += (pointer.offsetTop - head.y) * 0.1;
172
+
173
+ snake.unshift(head);
174
+ if (
175
+ Math.abs(head.x - food.x) < snakeSize &&
176
+ Math.abs(head.y - food.y) < snakeSize
177
+ ) {
178
+ score += 10;
179
+ food = { x: Math.random() * (canvas.width - snakeSize), y: Math.random() * (canvas.height - snakeSize) };
180
+ } else {
181
+ snake.pop();
182
+ }
183
+
184
+ if (
185
+ head.x < 0 ||
186
+ head.x > canvas.width ||
187
+ head.y < 0 ||
188
+ head.y > canvas.height ||
189
+ snake.some((segment, index) => index !== 0 && head.x === segment.x && head.y === segment.y)
190
+ ) {
191
+ endGame();
192
+ }
193
+ }
194
+
195
+ function updateTimer() {
196
+ if (timeLeft <= 0) {
197
+ endGame();
198
+ } else {
199
+ timeLeft--;
200
+ const minutes = Math.floor(timeLeft / 60);
201
+ const seconds = timeLeft % 60;
202
+ timerDisplay.textContent = `Time: ${minutes}:${seconds.toString().padStart(2, '0')}`;
203
+ }
204
+ }
205
+
206
+ function endGame() {
207
+ clearInterval(gameInterval);
208
+ clearInterval(timerInterval);
209
+ const popup = document.createElement('div');
210
+ popup.classList.add('popup');
211
+ popup.innerHTML = `<h2>Game Over</h2><p>Your Score: ${score}</p><button onclick="restartGame()">Restart</button>`;
212
+ document.body.appendChild(popup);
213
+ }
214
+
215
+ function restartGame() {
216
+ document.location.reload();
217
+ }
218
+
219
+ function gameLoop() {
220
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
221
+ drawSnake();
222
+ drawFood();
223
+ moveSnake();
224
+ scoreDisplay.textContent = `Score: ${score}`;
225
+ }
226
+
227
+ gameInterval = setInterval(gameLoop, 100);
228
+ timerInterval = setInterval(updateTimer, 1000);
229
+ </script>
230
+ </body>
231
+ </html>
hong-game.html ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Pong Game with Speed Control</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands.js"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/@mediapipe/drawing_utils/drawing_utils.js"></script>
10
+ <style>
11
+ * {
12
+ margin: 0;
13
+ padding: 0;
14
+ box-sizing: border-box;
15
+ }
16
+
17
+ body {
18
+ font-family: Arial, sans-serif;
19
+ background: linear-gradient(135deg, #74ebd5, #acb6e5);
20
+ color: white;
21
+ display: flex;
22
+ flex-direction: column;
23
+ justify-content: center;
24
+ align-items: center;
25
+ height: 100vh;
26
+ overflow: hidden;
27
+ }
28
+
29
+ .header {
30
+ width: 100%;
31
+ background-color: rgba(0, 0, 0, 0.7);
32
+ padding: 10px 0;
33
+ text-align: center;
34
+ position: fixed;
35
+ top: 0;
36
+ z-index: 100;
37
+ display: flex;
38
+ justify-content: space-between;
39
+ align-items: center;
40
+ padding: 0 20px;
41
+ box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
42
+ }
43
+
44
+ .header div {
45
+ color: white;
46
+ font-size: 18px;
47
+ font-weight: bold;
48
+ }
49
+
50
+ .game-container {
51
+ display: flex;
52
+ flex-direction: column;
53
+ align-items: center;
54
+ justify-content: center;
55
+ width: 100%;
56
+ height: 100%;
57
+ padding-top: 70px; /* Space for the header */
58
+ }
59
+
60
+ canvas {
61
+ border: 2px solid #fff;
62
+ border-radius: 10px;
63
+ background: #222;
64
+ max-width: 90%;
65
+ max-height: 70%;
66
+ width: auto;
67
+ height: auto;
68
+ }
69
+
70
+ .controls {
71
+ margin-top: 10px;
72
+ display: flex;
73
+ align-items: center;
74
+ gap: 10px;
75
+ }
76
+
77
+ .controls label {
78
+ font-size: 16px;
79
+ }
80
+
81
+ .controls input[type="range"] {
82
+ width: 150px;
83
+ }
84
+
85
+ video {
86
+ display: none;
87
+ }
88
+ </style>
89
+ </head>
90
+ <body>
91
+ <div class="header">
92
+ <div id="score">Score: 0</div>
93
+ <div id="timer">Time: 60</div>
94
+ </div>
95
+
96
+ <div class="game-container">
97
+ <canvas id="gameCanvas" width="500" height="500"></canvas>
98
+ <div class="controls">
99
+ <label for="speedControl">Ball Speed:</label>
100
+ <input type="range" id="speedControl" min="1" max="10" value="2" step="1">
101
+ </div>
102
+ </div>
103
+
104
+ <video id="webcam" autoplay playsinline></video>
105
+
106
+ <script>
107
+ const canvas = document.getElementById('gameCanvas');
108
+ const ctx = canvas.getContext('2d');
109
+ const scoreDisplay = document.getElementById('score');
110
+ const timerDisplay = document.getElementById('timer');
111
+ const speedControl = document.getElementById('speedControl');
112
+
113
+ let ball = {
114
+ x: canvas.width / 2,
115
+ y: canvas.height / 2,
116
+ radius: 10,
117
+ dx: 2,
118
+ dy: 2,
119
+ color: 'white',
120
+ };
121
+
122
+ let paddle = {
123
+ x: canvas.width / 2 - 50,
124
+ y: canvas.height - 20,
125
+ width: 100,
126
+ height: 10,
127
+ color: 'white',
128
+ };
129
+
130
+ let score = 0;
131
+ let timeLeft = 60;
132
+
133
+ // Update ball speed based on slider
134
+ speedControl.addEventListener('input', () => {
135
+ const speed = parseInt(speedControl.value);
136
+ ball.dx = Math.sign(ball.dx) * speed;
137
+ ball.dy = Math.sign(ball.dy) * speed;
138
+ });
139
+
140
+ // Draw ball
141
+ function drawBall() {
142
+ ctx.beginPath();
143
+ ctx.arc(ball.x, ball.y, ball.radius, 0, Math.PI * 2);
144
+ ctx.fillStyle = ball.color;
145
+ ctx.fill();
146
+ ctx.closePath();
147
+ }
148
+
149
+ // Draw paddle
150
+ function drawPaddle() {
151
+ ctx.fillStyle = paddle.color;
152
+ ctx.fillRect(paddle.x, paddle.y, paddle.width, paddle.height);
153
+ }
154
+
155
+ // Update ball position
156
+ function updateBall() {
157
+ ball.x += ball.dx;
158
+ ball.y += ball.dy;
159
+
160
+ // Bounce off walls
161
+ if (ball.x + ball.radius > canvas.width || ball.x - ball.radius < 0) {
162
+ ball.dx = -ball.dx;
163
+ }
164
+ if (ball.y - ball.radius < 0) {
165
+ ball.dy = -ball.dy;
166
+ }
167
+
168
+ // Bounce off paddle
169
+ if (
170
+ ball.y + ball.radius > paddle.y &&
171
+ ball.x > paddle.x &&
172
+ ball.x < paddle.x + paddle.width
173
+ ) {
174
+ ball.dy = -ball.dy;
175
+ score++;
176
+ }
177
+
178
+ // Reset if ball hits the bottom
179
+ if (ball.y + ball.radius > canvas.height) {
180
+ score = 0;
181
+ ball.x = canvas.width / 2;
182
+ ball.y = canvas.height / 2;
183
+ ball.dx = Math.sign(ball.dx) * parseInt(speedControl.value);
184
+ ball.dy = Math.sign(ball.dy) * parseInt(speedControl.value);
185
+ }
186
+
187
+ scoreDisplay.textContent = `Score: ${score}`;
188
+ }
189
+
190
+ // Timer
191
+ function startTimer() {
192
+ const timerInterval = setInterval(() => {
193
+ if (timeLeft > 0) {
194
+ timeLeft--;
195
+ timerDisplay.textContent = `Time: ${timeLeft}`;
196
+ } else {
197
+ clearInterval(timerInterval);
198
+ alert(`Game Over! Your score is ${score}`);
199
+ document.location.reload();
200
+ }
201
+ }, 1000);
202
+ }
203
+
204
+ // Game loop
205
+ function gameLoop() {
206
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
207
+ drawBall();
208
+ drawPaddle();
209
+ updateBall();
210
+ requestAnimationFrame(gameLoop);
211
+ }
212
+
213
+ // MediaPipe Hands setup
214
+ const hands = new Hands({
215
+ locateFile: (file) => `https://cdn.jsdelivr.net/npm/@mediapipe/hands/${file}`,
216
+ });
217
+
218
+ hands.setOptions({
219
+ maxNumHands: 1,
220
+ modelComplexity: 1,
221
+ minDetectionConfidence: 0.7,
222
+ minTrackingConfidence: 0.7,
223
+ });
224
+
225
+ const videoElement = document.getElementById('webcam');
226
+ const camera = new Camera(videoElement, {
227
+ onFrame: async () => {
228
+ await hands.send({ image: videoElement });
229
+ },
230
+ width: 640,
231
+ height: 480,
232
+ });
233
+ camera.start();
234
+
235
+ hands.onResults((results) => {
236
+ if (results.multiHandLandmarks && results.multiHandLandmarks.length > 0) {
237
+ const landmarks = results.multiHandLandmarks[0];
238
+ const indexFinger = landmarks[8]; // Index finger tip
239
+
240
+ // Map index finger x-coordinate to paddle position
241
+ paddle.x = indexFinger.x * canvas.width - paddle.width / 2;
242
+
243
+ // Ensure paddle stays within canvas bounds
244
+ if (paddle.x < 0) paddle.x = 0;
245
+ if (paddle.x + paddle.width > canvas.width) paddle.x = canvas.width - paddle.width;
246
+ }
247
+ });
248
+
249
+ startTimer();
250
+ gameLoop();
251
+ </script>
252
+ </body>
253
+ </html>
index - Copy.html ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>DeepSeek-Inspired Page</title>
7
+ <style>
8
+ /* Background Gradient Animation */
9
+ body {
10
+ font-family: Arial, sans-serif;
11
+ background: linear-gradient(135deg, #e0f2ff, #ffffff);
12
+ background-size: 200% 200%;
13
+ animation: bgAnimation 10s infinite alternate ease-in-out;
14
+ color: black;
15
+ margin: 0;
16
+ padding: 0;
17
+ text-align: center;
18
+ display: flex;
19
+ flex-direction: column;
20
+ align-items: center;
21
+ justify-content: center;
22
+ height: 100vh;
23
+ }
24
+
25
+ @keyframes bgAnimation {
26
+ 0% { background-position: 0% 50%; }
27
+ 100% { background-position: 100% 50%; }
28
+ }
29
+
30
+ /* Header Bar */
31
+ .header {
32
+ width: 100%;
33
+ padding: 10px 0;
34
+ text-align: center;
35
+ background: rgba(255, 255, 255, 0.3);
36
+ backdrop-filter: blur(10px);
37
+ position: fixed;
38
+ top: 0;
39
+ left: 0;
40
+ z-index: 1000;
41
+ }
42
+
43
+ .header p {
44
+ font-size: 14px;
45
+ color: #333;
46
+ }
47
+
48
+ /* DeepSeek Title */
49
+ h1 {
50
+ font-size: 50px;
51
+ font-weight: bold;
52
+ color: #187bff;
53
+ margin-bottom: 10px;
54
+ font-family: sans-serif;
55
+ text-transform: lowercase;
56
+ }
57
+
58
+ /* Subtitle */
59
+ p {
60
+ font-size: 22px;
61
+ color: #333;
62
+ margin-bottom: 40px;
63
+ }
64
+
65
+ /* Card Grid */
66
+ .grid-container {
67
+ display: grid;
68
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
69
+ gap: 20px;
70
+ width: 90%;
71
+ max-width: 1000px;
72
+ margin-top: 20px;
73
+ }
74
+
75
+ /* Glassmorphism Cards */
76
+ .card {
77
+ background: rgba(255, 255, 255, 0.3);
78
+ padding: 20px;
79
+ border-radius: 15px;
80
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
81
+ backdrop-filter: blur(10px);
82
+ cursor: pointer;
83
+ transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
84
+ text-align: left;
85
+ }
86
+
87
+ .card:hover {
88
+ background: rgba(255, 255, 255, 0.5);
89
+ transform: scale(1.05);
90
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
91
+ }
92
+
93
+ /* Card Titles */
94
+ .card h2 {
95
+ color: #187bff;
96
+ font-size: 18px;
97
+ margin-bottom: 10px;
98
+ }
99
+
100
+ /* Mobile Responsive */
101
+ @media (max-width: 768px) {
102
+ .grid-container {
103
+ grid-template-columns: repeat(2, 1fr);
104
+ }
105
+ }
106
+
107
+ @media (max-width: 500px) {
108
+ .grid-container {
109
+ grid-template-columns: repeat(1, 1fr);
110
+ }
111
+ }
112
+ </style>
113
+ </head>
114
+ <body>
115
+
116
+ <!-- Header Notification -->
117
+ <div class="header">
118
+ <p>🔔 DeepSeek-R1 is now live! Open-source AI rivaling OpenAI's Model 01.</p>
119
+ </div>
120
+
121
+ <h1>deepseek</h1>
122
+ <p>Into the unknown</p>
123
+
124
+ <!-- Cards Grid Section -->
125
+ <div class="grid-container">
126
+ <div class="card">
127
+ <h2>Start Now</h2>
128
+ <p>Free access to DeepSeek-V3. Experience the intelligent model.</p>
129
+ </div>
130
+ <div class="card">
131
+ <h2>Get DeepSeek App</h2>
132
+ <p>Chat on the go with DeepSeek-V3. Your free all-in-one AI tool.</p>
133
+ </div>
134
+ <div class="card">
135
+ <h2>AI Research</h2>
136
+ <p>Explore the latest advancements in AI and deep learning.</p>
137
+ </div>
138
+ <div class="card">
139
+ <h2>API Access</h2>
140
+ <p>Integrate DeepSeek AI into your own applications with our API.</p>
141
+ </div>
142
+ <div class="card">
143
+ <h2>Community</h2>
144
+ <p>Join a growing community of AI enthusiasts and developers.</p>
145
+ </div>
146
+ <div class="card">
147
+ <h2>Documentation</h2>
148
+ <p>Learn how to use DeepSeek effectively with our guides.</p>
149
+ </div>
150
+ </div>
151
+
152
+ </body>
153
+ </html>
media-pipe-pong.html ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>MediaPipe Line Pong</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-converter"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl"></script>
11
+ <script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/hand-pose-detection"></script>
12
+ <style>
13
+ body {
14
+ text-align: center;
15
+ font-family: Arial, sans-serif;
16
+ background-color: black;
17
+ color: white;
18
+ }
19
+ canvas {
20
+ background: #222;
21
+ display: block;
22
+ margin: auto;
23
+ }
24
+ </style>
25
+ </head>
26
+ <body>
27
+
28
+ <h1>🏓 MediaPipe Line Pong</h1>
29
+ <p>Move your hand to control the paddle!</p>
30
+
31
+ <canvas id="pongCanvas" width="800" height="400"></canvas>
32
+
33
+ <script>
34
+ const canvas = document.getElementById('pongCanvas');
35
+ const ctx = canvas.getContext('2d');
36
+
37
+ let paddleX = canvas.width / 2 - 50;
38
+ const paddleWidth = 100;
39
+ const paddleHeight = 10;
40
+
41
+ function drawPaddle() {
42
+ ctx.fillStyle = "white";
43
+ ctx.fillRect(paddleX, canvas.height - 20, paddleWidth, paddleHeight);
44
+ }
45
+
46
+ async function loadHandTracking() {
47
+ const model = await handPoseDetection.createDetector(
48
+ handPoseDetection.SupportedModels.MediaPipeHands,
49
+ { runtime: 'mediapipe', modelType: 'full' }
50
+ );
51
+
52
+ async function trackHand() {
53
+ const video = document.createElement("video");
54
+ video.autoplay = true;
55
+ const stream = await navigator.mediaDevices.getUserMedia({ video: true });
56
+ video.srcObject = stream;
57
+
58
+ async function detect() {
59
+ const hands = await model.estimateHands(video);
60
+ if (hands.length > 0) {
61
+ const x = hands[0].keypoints[8].x;
62
+ paddleX = (x / video.videoWidth) * canvas.width - paddleWidth / 2;
63
+ }
64
+ requestAnimationFrame(detect);
65
+ }
66
+
67
+ detect();
68
+ }
69
+
70
+ trackHand();
71
+ }
72
+
73
+ function gameLoop() {
74
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
75
+ drawPaddle();
76
+ requestAnimationFrame(gameLoop);
77
+ }
78
+
79
+ gameLoop();
80
+ loadHandTracking();
81
+ </script>
82
+
83
+ </body>
84
+ </html>
mk.html ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Flappy Bird with Hand Tracking</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands.js"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/@mediapipe/drawing_utils/drawing_utils.js"></script>
10
+ <style>
11
+ * {
12
+ margin: 0;
13
+ padding: 0;
14
+ box-sizing: border-box;
15
+ }
16
+
17
+ body {
18
+ font-family: Arial, sans-serif;
19
+ background: linear-gradient(135deg, #74ebd5, #acb6e5);
20
+ color: white;
21
+ display: flex;
22
+ flex-direction: column;
23
+ justify-content: center;
24
+ align-items: center;
25
+ height: 100vh;
26
+ overflow: hidden;
27
+ }
28
+
29
+ .header {
30
+ width: 100%;
31
+ background-color: rgba(0, 0, 0, 0.7);
32
+ padding: 10px 0;
33
+ text-align: center;
34
+ position: fixed;
35
+ top: 0;
36
+ z-index: 100;
37
+ display: flex;
38
+ justify-content: space-between;
39
+ align-items: center;
40
+ padding: 0 20px;
41
+ box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
42
+ }
43
+
44
+ .header div {
45
+ color: white;
46
+ font-size: 18px;
47
+ font-weight: bold;
48
+ }
49
+
50
+ .game-container {
51
+ display: flex;
52
+ flex-direction: column;
53
+ align-items: center;
54
+ justify-content: center;
55
+ width: 100%;
56
+ height: 100%;
57
+ padding-top: 70px; /* Space for the header */
58
+ }
59
+
60
+ canvas {
61
+ border: 2px solid #fff;
62
+ border-radius: 10px;
63
+ background: #222;
64
+ max-width: 90%;
65
+ max-height: 70%;
66
+ width: auto;
67
+ height: auto;
68
+ }
69
+
70
+ video {
71
+ display: none;
72
+ }
73
+ </style>
74
+ </head>
75
+ <body>
76
+ <div class="header">
77
+ <div id="score">Score: 0</div>
78
+ <div id="timer">Time: 60</div>
79
+ </div>
80
+
81
+ <div class="game-container">
82
+ <canvas id="gameCanvas" width="500" height="500"></canvas>
83
+ </div>
84
+
85
+ <video id="webcam" autoplay playsinline></video>
86
+
87
+ <script>
88
+ const canvas = document.getElementById('gameCanvas');
89
+ const ctx = canvas.getContext('2d');
90
+ const scoreDisplay = document.getElementById('score');
91
+ const timerDisplay = document.getElementById('timer');
92
+
93
+ let bird = {
94
+ x: 50,
95
+ y: canvas.height / 2,
96
+ radius: 15,
97
+ dy: 0,
98
+ gravity: 0.6,
99
+ lift: -10,
100
+ color: 'yellow',
101
+ };
102
+
103
+ let pipes = [];
104
+ let score = 0;
105
+ let timeLeft = 60;
106
+ let gameOver = false;
107
+
108
+ // Draw bird
109
+ function drawBird() {
110
+ ctx.beginPath();
111
+ ctx.arc(bird.x, bird.y, bird.radius, 0, Math.PI * 2);
112
+ ctx.fillStyle = bird.color;
113
+ ctx.fill();
114
+ ctx.closePath();
115
+ }
116
+
117
+ // Draw pipes
118
+ function drawPipes() {
119
+ ctx.fillStyle = 'green';
120
+ pipes.forEach(pipe => {
121
+ ctx.fillRect(pipe.x, 0, pipe.width, pipe.top);
122
+ ctx.fillRect(pipe.x, canvas.height - pipe.bottom, pipe.width, pipe.bottom);
123
+ });
124
+ }
125
+
126
+ // Update bird position
127
+ function updateBird() {
128
+ bird.dy += bird.gravity;
129
+ bird.y += bird.dy;
130
+
131
+ // Keep bird within canvas bounds
132
+ if (bird.y + bird.radius > canvas.height) {
133
+ bird.y = canvas.height - bird.radius;
134
+ bird.dy = 0;
135
+ }
136
+ if (bird.y - bird.radius < 0) {
137
+ bird.y = bird.radius;
138
+ bird.dy = 0;
139
+ }
140
+ }
141
+
142
+ // Update pipes
143
+ function updatePipes() {
144
+ if (pipes.length === 0 || pipes[pipes.length - 1].x < canvas.width - 200) {
145
+ const gap = 100;
146
+ const top = Math.random() * (canvas.height - gap - 100) + 50;
147
+ const bottom = canvas.height - top - gap;
148
+ pipes.push({ x: canvas.width, width: 50, top, bottom });
149
+ }
150
+
151
+ pipes.forEach(pipe => {
152
+ pipe.x -= 2;
153
+
154
+ // Check for collision
155
+ if (
156
+ bird.x + bird.radius > pipe.x &&
157
+ bird.x - bird.radius < pipe.x + pipe.width &&
158
+ (bird.y - bird.radius < pipe.top || bird.y + bird.radius > canvas.height - pipe.bottom)
159
+ ) {
160
+ gameOver = true;
161
+ }
162
+
163
+ // Increase score if bird passes a pipe
164
+ if (pipe.x + pipe.width < bird.x - bird.radius && !pipe.passed) {
165
+ score++;
166
+ pipe.passed = true;
167
+ }
168
+ });
169
+
170
+ // Remove off-screen pipes
171
+ pipes = pipes.filter(pipe => pipe.x + pipe.width > 0);
172
+ }
173
+
174
+ // Timer
175
+ function startTimer() {
176
+ const timerInterval = setInterval(() => {
177
+ if (timeLeft > 0 && !gameOver) {
178
+ timeLeft--;
179
+ timerDisplay.textContent = `Time: ${timeLeft}`;
180
+ } else {
181
+ clearInterval(timerInterval);
182
+ if (gameOver) {
183
+ alert(`Game Over! Your score is ${score}`);
184
+ } else {
185
+ alert(`Time's up! Your score is ${score}`);
186
+ }
187
+ document.location.reload();
188
+ }
189
+ }, 1000);
190
+ }
191
+
192
+ // Game loop
193
+ function gameLoop() {
194
+ if (gameOver) return;
195
+
196
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
197
+ drawBird();
198
+ drawPipes();
199
+ updateBird();
200
+ updatePipes();
201
+ scoreDisplay.textContent = `Score: ${score}`;
202
+ requestAnimationFrame(gameLoop);
203
+ }
204
+
205
+ // MediaPipe Hands setup
206
+ const hands = new Hands({
207
+ locateFile: (file) => `https://cdn.jsdelivr.net/npm/@mediapipe/hands/${file}`,
208
+ });
209
+
210
+ hands.setOptions({
211
+ maxNumHands: 1,
212
+ modelComplexity: 1,
213
+ minDetectionConfidence: 0.7,
214
+ minTrackingConfidence: 0.7,
215
+ });
216
+
217
+ const videoElement = document.getElementById('webcam');
218
+ const camera = new Camera(videoElement, {
219
+ onFrame: async () => {
220
+ await hands.send({ image: videoElement });
221
+ },
222
+ width: 640,
223
+ height: 480,
224
+ });
225
+ camera.start();
226
+
227
+ hands.onResults((results) => {
228
+ if (results.multiHandLandmarks && results.multiHandLandmarks.length > 0) {
229
+ const landmarks = results.multiHandLandmarks[0];
230
+ const indexFinger = landmarks[8]; // Index finger tip
231
+
232
+ // Map index finger y-coordinate to bird's lift
233
+ if (indexFinger.y * canvas.height < bird.y) {
234
+ bird.dy = bird.lift;
235
+ }
236
+ }
237
+ });
238
+
239
+ startTimer();
240
+ gameLoop();
241
+ </script>
242
+ </body>
243
+ </html>