GarGerry commited on
Commit
4bda677
Β·
verified Β·
1 Parent(s): 337f1de

Update Backup-html

Browse files
Files changed (1) hide show
  1. Backup-html +77 -94
Backup-html CHANGED
@@ -1,110 +1,93 @@
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>Futuristic Catch Game</title>
7
- <link rel="stylesheet" href="style.css">
8
  </head>
9
  <body>
10
- <div class="game-container">
11
- <div class="ball"></div>
12
- <div class="platform"></div>
13
- <div class="score-board">Score: <span id="score">0</span></div>
14
- </div>
15
- <div class="controls">
16
- <button id="left-button">β—€</button>
17
- <button id="right-button">β–Ά</button>
18
- </div>
19
- <script>
20
- const platform = document.querySelector('.platform');
21
- const ball = document.querySelector('.ball');
22
- const leftButton = document.getElementById('left-button');
23
- const rightButton = document.getElementById('right-button');
24
- const scoreDisplay = document.getElementById('score');
25
- const gameContainer = document.querySelector('.game-container');
26
-
27
- let platformPosition = 50; // Platform awal di tengah.
28
- let ballPosition = { top: 0, left: Math.random() * 90 }; // Bola muncul secara acak.
29
- let isCaught = false; // Apakah bola ditangkap.
30
- let score = 0; // Skor awal.
31
-
32
- // Fungsi untuk memindahkan platform ke kiri
33
- function movePlatformLeft() {
34
- if (platformPosition > 0) {
35
- platformPosition -= 5;
36
- }
37
- platform.style.left = platformPosition + '%';
38
- }
39
-
40
- // Fungsi untuk memindahkan platform ke kanan
41
- function movePlatformRight() {
42
- if (platformPosition < 90) {
43
- platformPosition += 5;
44
- }
45
- platform.style.left = platformPosition + '%';
46
- }
47
 
48
- // Keyboard controls
49
- window.addEventListener('keydown', (e) => {
50
- if (e.key === 'ArrowLeft') movePlatformLeft();
51
- if (e.key === 'ArrowRight') movePlatformRight();
52
- });
53
-
54
- // Button controls
55
- leftButton.addEventListener('click', movePlatformLeft);
56
- rightButton.addEventListener('click', movePlatformRight);
57
 
58
- // Mouse/Touch controls
59
- gameContainer.addEventListener('mousemove', (e) => {
60
- const containerWidth = gameContainer.offsetWidth;
61
- platformPosition = (e.clientX / containerWidth) * 100;
62
- platform.style.left = platformPosition + '%';
63
- });
 
 
64
 
65
- gameContainer.addEventListener('touchmove', (e) => {
66
- const touch = e.touches[0];
67
- const containerWidth = gameContainer.offsetWidth;
68
- platformPosition = (touch.clientX / containerWidth) * 100;
69
- platform.style.left = platformPosition + '%';
70
- });
 
 
 
 
 
71
 
72
- // Fungsi untuk menggerakkan bola
73
- function moveBall() {
74
- if (isCaught) return; // Jangan lanjut jika bola ditangkap.
75
- ballPosition.top += 2; // Bola turun.
76
- ball.style.top = ballPosition.top + '%';
77
- ball.style.left = ballPosition.left + '%';
 
 
 
78
 
79
- // Deteksi tabrakan (collision detection)
80
- if (ballPosition.top >= 90 && Math.abs(ballPosition.left - platformPosition) < 10) {
81
- isCaught = true;
82
- score++; // Tambahkan skor.
83
- scoreDisplay.textContent = score; // Update skor di layar.
84
- resetGame();
85
- }
86
 
87
- // Game over jika bola melewati platform
88
- if (ballPosition.top >= 100) {
89
- if (!isCaught) {
90
- alert('Game Over! Final Score: ' + score);
91
- score = 0; // Reset skor.
92
- scoreDisplay.textContent = score; // Update skor.
93
- }
94
- resetGame();
95
- }
96
 
97
- requestAnimationFrame(moveBall);
98
- }
 
 
 
99
 
100
- // Fungsi untuk mereset permainan
101
- function resetGame() {
102
- isCaught = false;
103
- ballPosition = { top: 0, left: Math.random() * 90 }; // Bola muncul ulang.
104
- }
105
 
106
- // Memulai permainan
107
- moveBall();
108
- </script>
 
 
 
 
 
 
109
  </body>
110
  </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>Portfolio Interaktif</title>
7
+ <link rel="stylesheet" href="style.css">
8
  </head>
9
  <body>
10
+ <header>
11
+ <h1>Selamat Datang di Portfolio Saya</h1>
12
+ <nav>
13
+ <ul>
14
+ <li><a href="#home">Home</a></li>
15
+ <li><a href="#skills">Skills</a></li>
16
+ <li><a href="#projects">Projects</a></li>
17
+ <li><a href="#contact">Contact</a></li>
18
+ </ul>
19
+ </nav>
20
+ <!-- Tombol Mode Gelap dengan Ikon -->
21
+ <button id="toggleDarkMode" aria-label="Toggle Dark Mode">πŸŒ™</button>
22
+ </header>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
+ <section id="home">
25
+ <h2>Hi, Saya [Nama Kamu]</h2>
26
+ <p>Seorang developer AI dan Blockchain yang selalu belajar.</p>
27
+ <button id="chatButton">Tanya Saya</button>
28
+ <div id="chatbox" class="hidden">
29
+ <p id="chatMessage">Halo! Saya adalah chatbot mini. Tanyakan apa saja tentang saya!</p>
30
+ </div>
31
+ </section>
 
32
 
33
+ <section id="skills">
34
+ <h2>Skills</h2>
35
+ <ul>
36
+ <li>Generative AI</li>
37
+ <li>Blockchain</li>
38
+ <li>Software Engineering</li>
39
+ </ul>
40
+ </section>
41
 
42
+ <section id="projects">
43
+ <h2>Projects</h2>
44
+ <div class="project">
45
+ <h3>Sentiment Analysis</h3>
46
+ <p>Web app untuk analisis sentimen dalam Bahasa Indonesia.</p>
47
+ </div>
48
+ <div class="project">
49
+ <h3>Visualisasi Squad Sepak Bola</h3>
50
+ <p>Tools untuk membuat formasi tim sepak bola dengan statistik pemain.</p>
51
+ </div>
52
+ </section>
53
 
54
+ <section id="contact">
55
+ <h2>Contact</h2>
56
+ <form>
57
+ <input type="text" placeholder="Nama" required>
58
+ <input type="email" placeholder="Email" required>
59
+ <textarea placeholder="Pesan"></textarea>
60
+ <button type="submit">Kirim</button>
61
+ </form>
62
+ </section>
63
 
64
+ <footer>
65
+ <p>&copy; 2025 [Nama Kamu]</p>
66
+ </footer>
 
 
 
 
67
 
68
+ <!-- JavaScript -->
69
+ <script>
70
+ // Fungsi untuk mengubah mode gelap
71
+ const toggleDarkModeButton = document.getElementById("toggleDarkMode");
 
 
 
 
 
72
 
73
+ // Cek apakah mode gelap sudah dipilih sebelumnya
74
+ if (localStorage.getItem('darkMode') === 'enabled') {
75
+ document.body.classList.add('dark-mode');
76
+ toggleDarkModeButton.textContent = 'β˜€οΈ'; // Ubah ikon ke matahari
77
+ }
78
 
79
+ // Event listener untuk tombol mode gelap
80
+ toggleDarkModeButton.addEventListener("click", function () {
81
+ document.body.classList.toggle("dark-mode");
 
 
82
 
83
+ if (document.body.classList.contains("dark-mode")) {
84
+ localStorage.setItem("darkMode", "enabled");
85
+ toggleDarkModeButton.textContent = 'β˜€οΈ'; // Ubah ikon ke matahari
86
+ } else {
87
+ localStorage.setItem("darkMode", "disabled");
88
+ toggleDarkModeButton.textContent = 'πŸŒ™'; // Ubah ikon ke bulan
89
+ }
90
+ });
91
+ </script>
92
  </body>
93
  </html>