codrizsain commited on
Commit
1003a59
·
verified ·
1 Parent(s): a8daeb9

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +57 -240
index.html CHANGED
@@ -3,7 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>AI Vision - v19 Smooth Performance</title>
7
 
8
  <script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js" crossorigin="anonymous"></script>
9
  <script src="https://cdn.jsdelivr.net/npm/@mediapipe/drawing_utils/drawing_utils.js" crossorigin="anonymous"></script>
@@ -14,7 +14,7 @@
14
  body {
15
  background: radial-gradient(circle at top, #1e293b, #0f172a);
16
  color: #f8fafc;
17
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
18
  display: flex;
19
  flex-direction: column;
20
  align-items: center;
@@ -28,109 +28,71 @@
28
 
29
  #startBtn {
30
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
31
- color: white;
32
- border: none;
33
- padding: 15px 35px;
34
- font-size: 18px;
35
- border-radius: 50px;
36
- cursor: pointer;
37
- font-weight: bold;
38
- box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
39
- transition: all 0.3s ease;
40
- margin: 20px 0;
41
- text-transform: uppercase;
42
- }
43
- #startBtn:hover {
44
- transform: translateY(-3px);
45
- box-shadow: 0 8px 25px rgba(236, 72, 153, 0.6);
46
- background: linear-gradient(135deg, #f472b6, #a78bfa);
47
  }
48
 
49
  #statusContainer {
50
- background: rgba(15, 23, 42, 0.8);
51
- border: 1px solid #334155;
52
- padding: 15px 30px;
53
- border-radius: 12px;
54
- margin-bottom: 20px;
55
- min-width: 300px;
56
- text-align: center;
57
- box-shadow: 0 4px 6px rgba(0,0,0,0.3);
58
  }
59
- #statusPose { font-size: 24px; font-weight: bold; color: #94a3b8; transition: color 0.3s; }
60
 
61
  .monitor-container { position: relative; }
62
 
63
  canvas {
64
  border: 3px solid #3b82f6;
65
  box-shadow: 0 0 25px rgba(59, 130, 246, 0.5);
66
- border-radius: 16px;
67
- background-color: #000;
68
- width: 640px;
69
- height: 480px;
70
- max-width: 90vw;
71
- object-fit: cover;
72
- transform: scaleX(-1);
73
  }
74
 
75
- /* PERBAIKAN CSS: Animasi GIF Transisi Halus (Anti-Blink) */
76
  .pose1-anim {
77
- position: absolute;
78
- opacity: 0; /* Default tidak terlihat */
79
- border-radius: 8px;
80
- z-index: 10;
81
- border: 2px solid #eab308;
82
- box-shadow: 0 0 15px rgba(234, 179, 8, 0.8);
83
- pointer-events: none;
84
- /* Transisi opacity ditambahkan agar memudar perlahan saat AI berkedip */
85
- transition: opacity 0.2s ease-in-out, left 0.1s linear, top 0.1s linear;
86
  transform: scaleX(-1);
87
  }
88
 
89
  #biometricContainer {
90
- position: absolute;
91
- top: 15px;
92
- right: 15px;
93
- background: rgba(15, 23, 42, 0.85);
94
- border: 2px solid #3b82f6;
95
- padding: 15px;
96
- border-radius: 12px;
97
- box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
98
- z-index: 20;
99
- backdrop-filter: blur(5px);
100
- transition: border-color 0.3s, box-shadow 0.3s;
101
- min-width: 150px;
102
  }
103
- .bio-label { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: 1px; margin-top: 8px; margin-bottom: 2px;}
104
- .bio-label:first-child { margin-top: 0; }
105
- .bio-value { font-size: 18px; font-weight: bold; color: #f8fafc; }
106
  .divider { height: 1px; background-color: #334155; margin: 8px 0; }
107
  </style>
108
  </head>
109
  <body>
110
 
111
- <h2>🤖 AI Vision: Smooth Tracking By Rizki Ardiansyah</h2>
112
- <p>Algoritma Debounce untuk Audio & Visual v19</p>
113
 
114
- <button id="startBtn">▶ Mulai Sistem Deteksi</button>
115
 
116
  <div id="statusContainer">
117
- <div id="statusPose">Menunggu Kamera...</div>
118
  </div>
119
 
120
  <div class="monitor-container">
121
  <div id="biometricContainer">
122
  <div class="bio-label">Kondisi Mood</div>
123
- <div id="moodValue" class="bio-value">Menganalisis...</div>
124
  <div class="divider"></div>
125
- <div class="bio-label">Estimasi Anatomi</div>
126
- <div id="genderValue" class="bio-value" style="color: #cbd5e1;">Memindai...</div>
127
  </div>
128
 
129
  <video id="videoElement" style="display: none;" autoplay playsinline></video>
130
  <canvas id="outputCanvas" width="640" height="480"></canvas>
131
 
132
- <img id="pose1Anim1" class="pose1-anim" src="animasi1.gif" alt="Pose 1">
133
- <img id="pose1Anim2" class="pose1-anim" src="animasi1.gif" alt="Pose 2">
134
  </div>
135
 
136
  <audio id="audio1" src="suara1.mp3"></audio>
@@ -145,69 +107,45 @@
145
  const canvasCtx = canvasElement.getContext('2d');
146
  const startBtn = document.getElementById('startBtn');
147
  const statusPose = document.getElementById('statusPose');
148
-
149
- const biometricContainer = document.getElementById('biometricContainer');
150
  const moodValue = document.getElementById('moodValue');
151
  const genderValue = document.getElementById('genderValue');
152
-
153
  const anims = [document.getElementById('pose1Anim1'), document.getElementById('pose1Anim2')];
154
  const sounds = [
155
  document.getElementById('audio1'), document.getElementById('audio2'),
156
  document.getElementById('audio3'), document.getElementById('audio4'),
157
  document.getElementById('audio5')
158
  ];
159
-
160
- // VARIABEL MEMORI (ANTI-LAG & ANTI-STUTTER)
161
  let memoryActivePoses = [];
162
  let memoryTimer = 0;
163
- let currentFaceLandmarks = null;
164
 
165
  function getDistance(p1, p2) { return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2)); }
166
 
167
- function analyzeFaceBiometrics(faceLandmarks) {
168
- // 1. Analisis Mood
169
- const leftMouth = faceLandmarks[61]; const rightMouth = faceLandmarks[291];
170
- const topLip = faceLandmarks[13]; const bottomLip = faceLandmarks[14];
171
- const leftEye = faceLandmarks[33]; const rightEye = faceLandmarks[263];
172
-
173
- const mouthWidth = getDistance(leftMouth, rightMouth);
174
- const mouthHeight = getDistance(topLip, bottomLip);
175
- const faceScale = getDistance(leftEye, rightEye);
176
-
177
- const smileRatio = mouthWidth / faceScale;
178
- const openRatio = mouthHeight / faceScale;
179
-
180
- let moodText = "Netral 😐"; let moodColor = "#3b82f6";
181
- if (openRatio > 0.15) { moodText = "Terkejut 😲"; moodColor = "#a855f7"; }
182
- else if (smileRatio > 0.52) { moodText = "Senang 😊"; moodColor = "#10b981"; }
183
-
184
- // 2. Analisis Estimasi Gender
185
- const leftCheek = faceLandmarks[234]; const rightCheek = faceLandmarks[454];
186
- const leftJaw = faceLandmarks[132]; const rightJaw = faceLandmarks[361];
187
-
188
- const cheekWidth = getDistance(leftCheek, rightCheek);
189
- const jawWidth = getDistance(leftJaw, rightJaw);
190
- const jawToCheekRatio = jawWidth / cheekWidth;
191
-
192
- // FITUR DEBUGGING: Menampilkan angka rasio di teks agar kamu bisa melihatnya
193
- // Fungsi .toFixed(3) digunakan untuk mengambil 3 angka di belakang koma
194
- let angkaRasio = jawToCheekRatio.toFixed(3);
195
 
196
- let genderText = ""; let genderColor = "";
 
 
 
 
 
 
 
 
197
 
198
- // ========================================================
199
- // UBAH ANGKA 0.820 DI BAWAH INI UNTUK MENYESUAIKAN AKURASI
200
- // ========================================================
201
- if (jawToCheekRatio > 0.820) {
202
- genderText = `Pria 👨 (${angkaRasio})`;
203
- genderColor = "#60a5fa";
204
- } else {
205
- genderText = `Wanita 👩 (${angkaRasio})`;
206
- genderColor = "#f472b6";
207
  }
208
 
209
- return { moodText, moodColor, genderText, genderColor };
210
  }
 
211
  function classifyPose(landmarks) {
212
  const indexOpen = landmarks[8].y < landmarks[6].y;
213
  const middleOpen = landmarks[12].y < landmarks[10].y;
@@ -219,134 +157,13 @@
219
  if (indexOpen && middleOpen && ringOpen && pinkyOpen && thumbOpen) return { id: 4, name: "🖐️ Telapak", color: "#3b82f6" };
220
  if (indexOpen && middleOpen && !ringOpen && !pinkyOpen) return { id: 2, name: "✌️ Victory", color: "#a855f7" };
221
  if (thumbOpen && indexOpen && !middleOpen && !ringOpen && !pinkyOpen) return { id: 1, name: "👉 Tunjuk & Jempol", color: "#eab308" };
222
-
223
- const thumbIndexTipDist = getDistance(landmarks[4], landmarks[8]);
224
- if (thumbIndexTipDist < 0.05 && middleOpen && ringOpen && pinkyOpen) return { id: 3, name: "👌 Okay", color: "#10b981" };
225
-
226
  return null;
227
  }
228
 
229
- const faceMesh = new FaceMesh({locateFile: (file) => { return `https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh/${file}`; }});
230
- faceMesh.setOptions({ maxNumFaces: 1, refineLandmarks: true, minDetectionConfidence: 0.7, minTrackingConfidence: 0.7 });
231
-
232
- faceMesh.onResults((results) => {
233
- currentFaceLandmarks = (results.multiFaceLandmarks && results.multiFaceLandmarks.length > 0) ? results.multiFaceLandmarks[0] : null;
234
- });
235
-
236
- const hands = new Hands({locateFile: (file) => { return `https://cdn.jsdelivr.net/npm/@mediapipe/hands/${file}`; }});
237
-
238
- // PERBAIKAN PERFORMA: modelComplexity diturunkan ke 0 agar 3x lebih cepat memproses 2 tangan sekaligus
239
- hands.setOptions({ maxNumHands: 2, modelComplexity: 0, minDetectionConfidence: 0.7, minTrackingConfidence: 0.7 });
240
-
241
- hands.onResults((results) => {
242
- canvasCtx.save();
243
- canvasCtx.clearRect(0, 0, canvasElement.width, canvasElement.height);
244
- canvasCtx.drawImage(results.image, 0, 0, canvasElement.width, canvasElement.height);
245
-
246
- if (currentFaceLandmarks) {
247
- drawConnectors(canvasCtx, currentFaceLandmarks, FACEMESH_TESSELATION, {color: '#06b6d4', lineWidth: 0.5});
248
- drawConnectors(canvasCtx, currentFaceLandmarks, FACEMESH_RIGHT_EYE, {color: '#ec4899', lineWidth: 2});
249
- drawConnectors(canvasCtx, currentFaceLandmarks, FACEMESH_RIGHT_EYEBROW, {color: '#ec4899', lineWidth: 2});
250
- drawConnectors(canvasCtx, currentFaceLandmarks, FACEMESH_LEFT_EYE, {color: '#ec4899', lineWidth: 2});
251
- drawConnectors(canvasCtx, currentFaceLandmarks, FACEMESH_LEFT_EYEBROW, {color: '#ec4899', lineWidth: 2});
252
- drawConnectors(canvasCtx, currentFaceLandmarks, FACEMESH_FACE_OVAL, {color: '#ec4899', lineWidth: 2});
253
- drawConnectors(canvasCtx, currentFaceLandmarks, FACEMESH_LIPS, {color: '#ec4899', lineWidth: 2});
254
- }
255
-
256
- let detectedPosesThisFrame = [];
257
- // Reset opacity GIF (bukan display none, agar tidak kaku)
258
- anims.forEach(a => a.style.opacity = '0');
259
-
260
- if (results.multiHandLandmarks && results.multiHandLandmarks.length > 0) {
261
- results.multiHandLandmarks.forEach((landmarks, index) => {
262
- let boneColor = index === 0 ? '#ec4899' : '#06b6d4';
263
- drawConnectors(canvasCtx, landmarks, HAND_CONNECTIONS, {color: boneColor, lineWidth: 4});
264
- drawLandmarks(canvasCtx, landmarks, {color: '#ffffff', lineWidth: 2, radius: 3});
265
-
266
- let pose = classifyPose(landmarks);
267
- if (pose) detectedPosesThisFrame.push({ ...pose, handIndex: index, wrist: landmarks[0] });
268
- });
269
- }
270
- canvasCtx.restore();
271
-
272
- // RENDER UI & LOGIKA
273
- if (currentFaceLandmarks) {
274
- let bio = analyzeFaceBiometrics(currentFaceLandmarks);
275
- let isPositivePose = detectedPosesThisFrame.some(p => p.id === 1 || p.id === 2 || p.id === 3);
276
- if (bio.moodText === "Senang 😊" && isPositivePose) {
277
- bio.moodText = "Sangat Senang! ✨"; bio.moodColor = "#eab308";
278
- }
279
- moodValue.textContent = bio.moodText; moodValue.style.color = bio.moodColor;
280
- genderValue.textContent = bio.genderText; genderValue.style.color = bio.genderColor;
281
- biometricContainer.style.borderColor = bio.moodColor; biometricContainer.style.boxShadow = `0 0 15px ${bio.moodColor}80`;
282
- } else {
283
- moodValue.textContent = "Wajah Hilang"; moodValue.style.color = "#94a3b8";
284
- genderValue.textContent = "Wajah Hilang"; genderValue.style.color = "#94a3b8";
285
- biometricContainer.style.borderColor = "#334155";
286
- }
287
-
288
- // --- LOGIKA AUDIO DENGAN MEMORI DEBOUNCE ---
289
- let currentIds = detectedPosesThisFrame.map(p => p.id);
290
-
291
- if (currentIds.length > 0) {
292
- let uniquePoseNames = [...new Set(detectedPosesThisFrame.map(p => p.name))];
293
- statusPose.textContent = uniquePoseNames.join(" & ");
294
- statusPose.style.color = detectedPosesThisFrame[0].color;
295
-
296
- // Perbarui posisi GIF dengan halus
297
- detectedPosesThisFrame.forEach((pose, i) => {
298
- if (pose.id === 1 && anims[i]) {
299
- const wrist = pose.wrist;
300
- const leftPos = ((1 - wrist.x) * canvasElement.width) - 75;
301
- const topPos = (wrist.y * canvasElement.height) + 30;
302
-
303
- anims[i].style.opacity = '1'; // Munculkan dengan efek fade
304
- anims[i].style.left = `${leftPos}px`;
305
- anims[i].style.top = `${topPos}px`;
306
- anims[i].style.width = `150px`;
307
- }
308
- });
309
-
310
- // Cek pose baru yang belum ada di memori stabil
311
- let newPoses = currentIds.filter(id => !memoryActivePoses.includes(id));
312
-
313
- if (newPoses.length > 0) {
314
- let primaryNewPoseId = newPoses[0];
315
- sounds.forEach(s => { s.pause(); s.currentTime = 0; });
316
- const soundToPlay = sounds[primaryNewPoseId - 1];
317
- if (soundToPlay) soundToPlay.play();
318
- }
319
-
320
- memoryActivePoses = currentIds; // Simpan memori terbaru
321
- memoryTimer = Date.now(); // Reset stopwatch memori
322
-
323
- } else {
324
- // Tangan tidak terdeteksi. Jangan langsung bersihkan memori! Tunggu 0.5 detik (500ms)
325
- if (Date.now() - memoryTimer > 500) {
326
- if (memoryActivePoses.length > 0) {
327
- statusPose.textContent = "Menunggu formasi jari...";
328
- statusPose.style.color = "#94a3b8";
329
- memoryActivePoses = [];
330
- }
331
- }
332
- }
333
- });
334
-
335
- startBtn.addEventListener('click', () => {
336
- startBtn.style.display = 'none';
337
- statusPose.textContent = "Menyiapkan Kamera...";
338
- sounds.forEach(s => { s.play().then(() => { s.pause(); s.currentTime = 0; }).catch(()=>{}); });
339
 
340
- const camera = new Camera(videoElement, {
341
- onFrame: async () => {
342
- await faceMesh.send({image: videoElement});
343
- await hands.send({image: videoElement});
344
- },
345
- width: 640,
346
- height: 480
347
- });
348
- camera.start();
349
- });
350
- </script>
351
- </body>
352
- </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI Vision v20 - Rizki Ardiansyah</title>
7
 
8
  <script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js" crossorigin="anonymous"></script>
9
  <script src="https://cdn.jsdelivr.net/npm/@mediapipe/drawing_utils/drawing_utils.js" crossorigin="anonymous"></script>
 
14
  body {
15
  background: radial-gradient(circle at top, #1e293b, #0f172a);
16
  color: #f8fafc;
17
+ font-family: 'Segoe UI', sans-serif;
18
  display: flex;
19
  flex-direction: column;
20
  align-items: center;
 
28
 
29
  #startBtn {
30
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
31
+ color: white; border: none; padding: 15px 35px;
32
+ font-size: 18px; border-radius: 50px; cursor: pointer;
33
+ font-weight: bold; box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
34
+ transition: all 0.3s ease; margin: 20px 0;
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
 
37
  #statusContainer {
38
+ background: rgba(15, 23, 42, 0.8); border: 1px solid #334155;
39
+ padding: 15px 30px; border-radius: 12px; margin-bottom: 20px;
40
+ min-width: 300px; text-align: center;
 
 
 
 
 
41
  }
 
42
 
43
  .monitor-container { position: relative; }
44
 
45
  canvas {
46
  border: 3px solid #3b82f6;
47
  box-shadow: 0 0 25px rgba(59, 130, 246, 0.5);
48
+ border-radius: 16px; background-color: #000;
49
+ width: 640px; height: 480px; max-width: 90vw;
50
+ object-fit: cover; transform: scaleX(-1);
 
 
 
 
51
  }
52
 
 
53
  .pose1-anim {
54
+ position: absolute; opacity: 0; border-radius: 8px; z-index: 10;
55
+ border: 2px solid #eab308; box-shadow: 0 0 15px rgba(234, 179, 8, 0.8);
56
+ pointer-events: none; transition: opacity 0.2s, left 0.1s, top 0.1s;
 
 
 
 
 
 
57
  transform: scaleX(-1);
58
  }
59
 
60
  #biometricContainer {
61
+ position: absolute; top: 15px; right: 15px;
62
+ background: rgba(15, 23, 42, 0.85); border: 2px solid #3b82f6;
63
+ padding: 15px; border-radius: 12px; z-index: 20;
64
+ backdrop-filter: blur(5px); min-width: 160px;
 
 
 
 
 
 
 
 
65
  }
66
+ .bio-label { font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: 1px; }
67
+ .bio-value { font-size: 17px; font-weight: bold; color: #f8fafc; margin-bottom: 5px; }
 
68
  .divider { height: 1px; background-color: #334155; margin: 8px 0; }
69
  </style>
70
  </head>
71
  <body>
72
 
73
+ <h2>🤖 AI Vision: Ultimate Tracking By Rizki</h2>
74
+ <p>Smart Biometrics & Debounce System v20</p>
75
 
76
+ <button id="startBtn">▶ Jalankan Sistem AI</button>
77
 
78
  <div id="statusContainer">
79
+ <div id="statusPose" style="font-size: 24px; font-weight: bold; color: #94a3b8;">Menunggu Kamera...</div>
80
  </div>
81
 
82
  <div class="monitor-container">
83
  <div id="biometricContainer">
84
  <div class="bio-label">Kondisi Mood</div>
85
+ <div id="moodValue" class="bio-value">...</div>
86
  <div class="divider"></div>
87
+ <div class="bio-label">Estimasi Gender</div>
88
+ <div id="genderValue" class="bio-value">...</div>
89
  </div>
90
 
91
  <video id="videoElement" style="display: none;" autoplay playsinline></video>
92
  <canvas id="outputCanvas" width="640" height="480"></canvas>
93
 
94
+ <img id="pose1Anim1" class="pose1-anim" src="animasi1.gif">
95
+ <img id="pose1Anim2" class="pose1-anim" src="animasi1.gif">
96
  </div>
97
 
98
  <audio id="audio1" src="suara1.mp3"></audio>
 
107
  const canvasCtx = canvasElement.getContext('2d');
108
  const startBtn = document.getElementById('startBtn');
109
  const statusPose = document.getElementById('statusPose');
 
 
110
  const moodValue = document.getElementById('moodValue');
111
  const genderValue = document.getElementById('genderValue');
 
112
  const anims = [document.getElementById('pose1Anim1'), document.getElementById('pose1Anim2')];
113
  const sounds = [
114
  document.getElementById('audio1'), document.getElementById('audio2'),
115
  document.getElementById('audio3'), document.getElementById('audio4'),
116
  document.getElementById('audio5')
117
  ];
118
+
 
119
  let memoryActivePoses = [];
120
  let memoryTimer = 0;
121
+ let currentFaceLandmarks = null;
122
 
123
  function getDistance(p1, p2) { return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2)); }
124
 
125
+ function analyzeFace(face) {
126
+ // Mood Logic
127
+ const smileRatio = getDistance(face[61], face[291]) / getDistance(face[33], face[263]);
128
+ const openRatio = getDistance(face[13], face[14]) / getDistance(face[33], face[263]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
+ let mood = { text: "Netral 😐", color: "#3b82f6" };
131
+ if (openRatio > 0.15) mood = { text: "Terkejut 😲", color: "#a855f7" };
132
+ else if (smileRatio > 0.52) mood = { text: "Senang 😊", color: "#10b981" };
133
+
134
+ // SMART GENDER LOGIC (Hijab Friendly)
135
+ // Cek Alis (Biasanya wanita lebih melengkung tinggi)
136
+ const eyebrowRatio = getDistance(face[159], face[52]) / getDistance(face[10], face[152]);
137
+ // Cek Rahang
138
+ const jawRatio = getDistance(face[132], face[361]) / getDistance(face[234], face[454]);
139
 
140
+ let gender = { text: "Pria 👨", color: "#60a5fa" };
141
+ // Jika Alis Tinggi (>0.050) OTOMATIS Wanita (Mengabaikan kain hijab di rahang)
142
+ if (eyebrowRatio > 0.050 || jawRatio < 0.755) {
143
+ gender = { text: "Wanita 👩", color: "#f472b6" };
 
 
 
 
 
144
  }
145
 
146
+ return { mood, gender };
147
  }
148
+
149
  function classifyPose(landmarks) {
150
  const indexOpen = landmarks[8].y < landmarks[6].y;
151
  const middleOpen = landmarks[12].y < landmarks[10].y;
 
157
  if (indexOpen && middleOpen && ringOpen && pinkyOpen && thumbOpen) return { id: 4, name: "🖐️ Telapak", color: "#3b82f6" };
158
  if (indexOpen && middleOpen && !ringOpen && !pinkyOpen) return { id: 2, name: "✌️ Victory", color: "#a855f7" };
159
  if (thumbOpen && indexOpen && !middleOpen && !ringOpen && !pinkyOpen) return { id: 1, name: "👉 Tunjuk & Jempol", color: "#eab308" };
160
+ if (getDistance(landmarks[4], landmarks[8]) < 0.05 && middleOpen) return { id: 3, name: "👌 Okay", color: "#10b981" };
 
 
 
161
  return null;
162
  }
163
 
164
+ const faceMesh = new FaceMesh({locateFile: (f) => `https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh/${f}`});
165
+ faceMesh.setOptions({ maxNumFaces: 1, refineLandmarks: true, minDetectionConfidence: 0.7 });
166
+ faceMesh.onResults((res) => { currentFaceLandmarks = res.multiFaceLandmarks?.[0]; });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
 
168
+ const hands = new Hands({locateFile: (f) => `https://cdn.jsdelivr.net/npm/@mediapipe/hands/${f}`});
169
+ hands.setOptions({ maxNumHands: 2