DataLR commited on
Commit
6c9e867
Β·
verified Β·
1 Parent(s): 4fb23af

I want a futuristic design

Browse files
Files changed (5) hide show
  1. README.md +9 -5
  2. components/navbar.js +55 -0
  3. index.html +37 -19
  4. script.js +185 -0
  5. style.css +66 -19
README.md CHANGED
@@ -1,10 +1,14 @@
1
  ---
2
- title: Neon Grid Velocity
3
- emoji: πŸ‘€
4
- colorFrom: green
5
- colorTo: purple
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
1
  ---
2
+ title: Neon Grid Velocity πŸš€
3
+ colorFrom: gray
4
+ colorTo: gray
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
14
+
components/navbar.js ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomNavbar extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ nav {
7
+ background: rgba(10, 10, 30, 0.8);
8
+ padding: 1rem;
9
+ display: flex;
10
+ justify-content: space-between;
11
+ align-items: center;
12
+ box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
13
+ position: relative;
14
+ z-index: 10;
15
+ border-bottom: 1px solid #00ffff;
16
+ }
17
+ .logo {
18
+ color: #00ffff;
19
+ font-weight: bold;
20
+ font-size: 1.25rem;
21
+ letter-spacing: 2px;
22
+ font-family: 'Orbitron', sans-serif;
23
+ text-shadow: 0 0 10px #00ffff;
24
+ }
25
+ .controls {
26
+ display: flex;
27
+ gap: 1.5rem;
28
+ color: #00ffff;
29
+ font-size: 0.9rem;
30
+ font-family: 'Orbitron', sans-serif;
31
+ text-shadow: 0 0 5px #00ffff;
32
+ }
33
+ .controls span {
34
+ display: flex;
35
+ align-items: center;
36
+ gap: 0.5rem;
37
+ padding: 0.3rem 0.6rem;
38
+ border: 1px solid #00ffff;
39
+ border-radius: 4px;
40
+ background: rgba(0, 255, 255, 0.1);
41
+ }
42
+ </style>
43
+ <nav>
44
+ <div class="logo">PIXELRACER TURBO 🏁</div>
45
+ <div class="controls">
46
+ <span><i data-feather="arrow-left"></i> Left</span>
47
+ <span><i data-feather="arrow-right"></i> Right</span>
48
+ <span><i data-feather="arrow-up"></i> Up</span>
49
+ <span><i data-feather="arrow-down"></i> Down</span>
50
+ </div>
51
+ </nav>
52
+ `;
53
+ }
54
+ }
55
+ customElements.define('custom-navbar', CustomNavbar);
index.html CHANGED
@@ -1,19 +1,37 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Neon Grid Velocity πŸš€</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap" rel="stylesheet">
9
+ <script src="https://cdn.tailwindcss.com"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
11
+ <script src="https://unpkg.com/feather-icons"></script>
12
+ </head>
13
+ <body class="bg-black text-white overflow-hidden">
14
+ <custom-navbar></custom-navbar>
15
+
16
+ <div id="game-container" class="relative w-full h-screen overflow-hidden">
17
+ <div id="road" class="absolute w-full h-full bg-gray-800"></div>
18
+ <div id="player-car" class="absolute w-16 h-28 bg-red-500 rounded-lg"></div>
19
+ <div id="score" class="absolute top-4 right-4 text-2xl font-bold bg-black bg-opacity-50 px-4 py-2 rounded-lg">Score: 0</div>
20
+ <div id="game-over" class="absolute inset-0 flex flex-col items-center justify-center bg-black bg-opacity-70 hidden">
21
+ <h2 class="text-4xl font-bold mb-4 text-red-500">GAME OVER</h2>
22
+ <p id="final-score" class="text-2xl mb-6">Score: 0</p>
23
+ <button id="restart-btn" class="px-6 py-3 bg-blue-600 hover:bg-blue-700 rounded-lg font-bold transition">RESTART</button>
24
+ </div>
25
+ <div id="start-screen" class="absolute inset-0 flex flex-col items-center justify-center bg-black bg-opacity-70">
26
+ <h1 class="text-5xl font-bold mb-6 font-orbitron text-transparent bg-clip-text bg-gradient-to-r from-cyan-400 to-purple-500">NEON GRID VELOCITY</h1>
27
+ <p class="text-xl mb-8 text-cyan-300">Use arrow keys to navigate the cyberspace</p>
28
+ <button id="start-btn" class="px-6 py-3 rounded-lg font-bold transition">ENGAGE DRIVE</button>
29
+ </div>
30
+ </div>
31
+
32
+ <script src="components/navbar.js"></script>
33
+ <script src="script.js"></script>
34
+ <script>feather.replace();</script>
35
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
36
+ </body>
37
+ </html>
script.js ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', () => {
2
+ // Game elements
3
+ const playerCar = document.getElementById('player-car');
4
+ const gameContainer = document.getElementById('game-container');
5
+ const road = document.getElementById('road');
6
+ const scoreElement = document.getElementById('score');
7
+ const gameOverScreen = document.getElementById('game-over');
8
+ const finalScoreElement = document.getElementById('final-score');
9
+ const restartBtn = document.getElementById('restart-btn');
10
+ const startScreen = document.getElementById('start-screen');
11
+ const startBtn = document.getElementById('start-btn');
12
+
13
+ // Game state
14
+ let gameRunning = false;
15
+ let score = 0;
16
+ let obstacles = [];
17
+ let animationId;
18
+ let speed = 3;
19
+ let gameSpeed = 2;
20
+ let playerPosition = {
21
+ x: gameContainer.offsetWidth / 2 - playerCar.offsetWidth / 2,
22
+ y: gameContainer.offsetHeight - playerCar.offsetHeight - 20
23
+ };
24
+
25
+ // Initialize player car position
26
+ playerCar.style.left = `${playerPosition.x}px`;
27
+ playerCar.style.top = `${playerPosition.y}px`;
28
+
29
+ // Event listeners
30
+ startBtn.addEventListener('click', startGame);
31
+ restartBtn.addEventListener('click', startGame);
32
+
33
+ // Keyboard controls
34
+ const keys = {
35
+ ArrowLeft: false,
36
+ ArrowRight: false,
37
+ ArrowUp: false,
38
+ ArrowDown: false
39
+ };
40
+
41
+ document.addEventListener('keydown', (e) => {
42
+ if (keys.hasOwnProperty(e.key)) {
43
+ keys[e.key] = true;
44
+ }
45
+ });
46
+
47
+ document.addEventListener('keyup', (e) => {
48
+ if (keys.hasOwnProperty(e.key)) {
49
+ keys[e.key] = false;
50
+ }
51
+ });
52
+
53
+ // Game functions
54
+ function startGame() {
55
+ // Reset game state
56
+ score = 0;
57
+ speed = 3;
58
+ gameSpeed = 2;
59
+ obstacles.forEach(obs => obs.element.remove());
60
+ obstacles = [];
61
+ scoreElement.textContent = `Score: ${score}`;
62
+
63
+ // Reset player position
64
+ playerPosition = {
65
+ x: gameContainer.offsetWidth / 2 - playerCar.offsetWidth / 2,
66
+ y: gameContainer.offsetHeight - playerCar.offsetHeight - 20
67
+ };
68
+ playerCar.style.left = `${playerPosition.x}px`;
69
+ playerCar.style.top = `${playerPosition.y}px`;
70
+
71
+ // Hide screens
72
+ gameOverScreen.classList.add('hidden');
73
+ startScreen.classList.add('hidden');
74
+
75
+ // Start game loop
76
+ gameRunning = true;
77
+ gameLoop();
78
+ }
79
+
80
+ function gameLoop() {
81
+ if (!gameRunning) return;
82
+
83
+ // Move player
84
+ if (keys.ArrowLeft && playerPosition.x > 20) {
85
+ playerPosition.x -= speed;
86
+ }
87
+ if (keys.ArrowRight && playerPosition.x < gameContainer.offsetWidth - playerCar.offsetWidth - 20) {
88
+ playerPosition.x += speed;
89
+ }
90
+ if (keys.ArrowUp && playerPosition.y > 0) {
91
+ playerPosition.y -= speed;
92
+ }
93
+ if (keys.ArrowDown && playerPosition.y < gameContainer.offsetHeight - playerCar.offsetHeight) {
94
+ playerPosition.y += speed;
95
+ }
96
+
97
+ playerCar.style.left = `${playerPosition.x}px`;
98
+ playerCar.style.top = `${playerPosition.y}px`;
99
+
100
+ // Generate obstacles
101
+ if (Math.random() < 0.02) {
102
+ createObstacle();
103
+ }
104
+
105
+ // Move obstacles
106
+ moveObstacles();
107
+
108
+ // Check collisions
109
+ if (checkCollisions()) {
110
+ gameOver();
111
+ return;
112
+ }
113
+
114
+ // Update score
115
+ score++;
116
+ scoreElement.textContent = `Score: ${score}`;
117
+
118
+ // Increase difficulty
119
+ if (score % 500 === 0) {
120
+ gameSpeed += 0.2;
121
+ }
122
+
123
+ animationId = requestAnimationFrame(gameLoop);
124
+ }
125
+
126
+ function createObstacle() {
127
+ const width = Math.random() * 100 + 50;
128
+ const height = Math.random() * 70 + 30;
129
+ const x = Math.random() * (gameContainer.offsetWidth - width);
130
+
131
+ const obstacle = document.createElement('div');
132
+ obstacle.className = 'obstacle';
133
+ obstacle.style.width = `${width}px`;
134
+ obstacle.style.height = `${height}px`;
135
+ obstacle.style.left = `${x}px`;
136
+ obstacle.style.top = `-${height}px`;
137
+ gameContainer.appendChild(obstacle);
138
+
139
+ obstacles.push({
140
+ element: obstacle,
141
+ x,
142
+ y: -height,
143
+ width,
144
+ height
145
+ });
146
+ }
147
+
148
+ function moveObstacles() {
149
+ obstacles.forEach(obstacle => {
150
+ obstacle.y += gameSpeed;
151
+ obstacle.element.style.top = `${obstacle.y}px`;
152
+
153
+ // Remove obstacles that are off screen
154
+ if (obstacle.y > gameContainer.offsetHeight) {
155
+ obstacle.element.remove();
156
+ obstacles = obstacles.filter(obs => obs !== obstacle);
157
+ }
158
+ });
159
+ }
160
+
161
+ function checkCollisions() {
162
+ const playerRect = {
163
+ x: playerPosition.x,
164
+ y: playerPosition.y,
165
+ width: playerCar.offsetWidth,
166
+ height: playerCar.offsetHeight
167
+ };
168
+
169
+ return obstacles.some(obstacle => {
170
+ return !(
171
+ playerRect.x + playerRect.width < obstacle.x ||
172
+ playerRect.x > obstacle.x + obstacle.width ||
173
+ playerRect.y + playerRect.height < obstacle.y ||
174
+ playerRect.y > obstacle.y + obstacle.height
175
+ );
176
+ });
177
+ }
178
+
179
+ function gameOver() {
180
+ gameRunning = false;
181
+ cancelAnimationFrame(animationId);
182
+ finalScoreElement.textContent = `Score: ${score}`;
183
+ gameOverScreen.classList.remove('hidden');
184
+ }
185
+ });
style.css CHANGED
@@ -1,28 +1,75 @@
1
- body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
 
 
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
 
 
 
28
  }
 
1
+
2
+ /* Futuristic road with neon grid */
3
+ #road {
4
+ background-color: #0a0a15;
5
+ background-image:
6
+ linear-gradient(to bottom,
7
+ transparent 0%,
8
+ transparent 48%,
9
+ rgba(0, 255, 255, 0.2) 48%,
10
+ rgba(0, 255, 255, 0.2) 52%,
11
+ transparent 52%,
12
+ transparent 100%),
13
+ linear-gradient(to right,
14
+ rgba(0, 255, 255, 0.05) 0%,
15
+ rgba(0, 255, 255, 0.05) 49%,
16
+ transparent 49%,
17
+ transparent 51%,
18
+ rgba(0, 255, 255, 0.05) 51%,
19
+ rgba(0, 255, 255, 0.05) 100%);
20
+ background-size: 100px 100px, 100px 100px;
21
+ animation: roadMove 0.5s linear infinite;
22
+ box-shadow: 0 0 30px rgba(0, 255, 255, 0.3) inset;
23
+ }
24
+
25
+ @keyframes roadMove {
26
+ from { background-position: 0 0, 0 0; }
27
+ to { background-position: 0 100px, 0 0; }
28
+ }
29
+
30
+ /* Futuristic obstacles */
31
+ .obstacle {
32
+ position: absolute;
33
+ background-color: #ff00ff;
34
+ border-radius: 5px;
35
+ box-shadow: 0 0 15px #ff00ff, 0 0 30px rgba(255, 0, 255, 0.3);
36
+ }
37
+
38
+ /* Player car */
39
+ #player-car {
40
+ background: linear-gradient(135deg, #00ffff 0%, #ff00ff 100%);
41
+ box-shadow: 0 0 20px #00ffff, 0 0 40px rgba(0, 255, 255, 0.3);
42
+ border-radius: 10px;
43
+ }
44
+
45
+ /* Game screens */
46
+ #game-over, #start-screen {
47
+ background: rgba(10, 10, 30, 0.9);
48
+ border: 2px solid #00ffff;
49
+ box-shadow: 0 0 30px #00ffff;
50
  }
51
 
52
+ #game-over h2, #start-screen h1 {
53
+ text-shadow: 0 0 10px #00ffff, 0 0 20px rgba(0, 255, 255, 0.5);
 
54
  }
55
 
56
+ button {
57
+ background: linear-gradient(135deg, #00ffff 0%, #ff00ff 100%);
58
+ box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
59
+ border: none;
60
+ color: #111;
61
+ font-weight: bold;
62
+ transition: all 0.3s;
63
  }
64
 
65
+ button:hover {
66
+ transform: scale(1.05);
67
+ box-shadow: 0 0 25px rgba(0, 255, 255, 0.8);
 
 
 
68
  }
69
 
70
+ #score {
71
+ background: rgba(10, 10, 30, 0.7);
72
+ border: 1px solid #00ffff;
73
+ color: #00ffff;
74
+ text-shadow: 0 0 5px #00ffff;
75
  }