HTMLify
index.html
Views: 36 | Author: devwajahat
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 | <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Top-Row Number Pro with Finger Guide</title> <style> :root { --bg: #f8fafc; --card: #ffffff; --accent: #6366f1; --correct: #22c55e; --wrong: #ef4444; --finger-highlight: #6366f1; --key-border: #e2e8f0; } body { font-family: 'Inter', system-ui, sans-serif; background-color: var(--bg); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .container { background: var(--card); padding: 3rem; border-radius: 20px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); text-align: center; width: 700px; } .display-area { font-size: 3rem; font-weight: 700; letter-spacing: 0.5rem; margin-bottom: 2rem; font-family: 'Courier New', monospace; color: #cbd5e1; } .char.current { color: var(--accent); border-bottom: 4px solid var(--accent); } .char.correct { color: #1e293b; } .keyboard-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 30px; } .key { width: 45px; height: 45px; border: 2px solid var(--key-border); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: bold; transition: all 0.2s; } .key.active { background: var(--accent); color: white; border-color: var(--accent); transform: scale(1.1); } /* Hand Visualization */ .hands-container { display: flex; justify-content: space-between; width: 400px; margin: 0 auto; opacity: 0.8; } .hand { display: flex; gap: 10px; align-items: flex-end; height: 100px; } .finger { width: 25px; background: #e2e8f0; border-radius: 12px 12px 4px 4px; transition: all 0.2s; position: relative; } /* Finger Heights */ .f-pinky { height: 50px; } .f-ring { height: 75px; } .f-middle { height: 85px; } .f-index { height: 80px; } .finger.active { background: var(--finger-highlight); box-shadow: 0 0 15px var(--finger-highlight); height: 95px; /* "Reach" animation */ } .finger-label { position: absolute; bottom: -20px; font-size: 10px; width: 100%; color: #94a3b8; } </style> </head> <body> <div class="container"> <h2 style="margin-top:0">Top-Row Touch Typing</h2> <div id="displayArea" class="display-area"></div> <div class="keyboard-row"> <div class="key" id="k1">1</div><div class="key" id="k2">2</div> <div class="key" id="k3">3</div><div class="key" id="k4">4</div> <div class="key" id="k5">5</div><div class="key" id="k6">6</div> <div class="key" id="k7">7</div><div class="key" id="k8">8</div> <div class="key" id="k9">9</div><div class="key" id="k0">0</div> </div> <div class="hands-container"> <div class="hand"> <div class="finger f-pinky" id="f-l-pinky"><span class="finger-label">L-P</span></div> <div class="finger f-ring" id="f-l-ring"><span class="finger-label">L-R</span></div> <div class="finger f-middle" id="f-l-middle"><span class="finger-label">L-M</span></div> <div class="finger f-index" id="f-l-index"><span class="finger-label">L-I</span></div> </div> <div class="hand"> <div class="finger f-index" id="f-r-index"><span class="finger-label">R-I</span></div> <div class="finger f-middle" id="f-r-middle"><span class="finger-label">R-M</span></div> <div class="finger f-ring" id="f-r-ring"><span class="finger-label">R-R</span></div> <div class="finger f-pinky" id="f-r-pinky"><span class="finger-label">R-P</span></div> </div> </div> <p style="margin-top: 40px; color: #64748b;">Follow the <b>Blue Finger</b> highlight</p> </div> <script> const displayArea = document.getElementById('displayArea'); let target = ""; let currentIndex = 0; // Mapping keys to fingers const fingerMap = { '1': 'f-l-pinky', '2': 'f-l-ring', '3': 'f-l-middle', '4': 'f-l-index', '5': 'f-l-index', '6': 'f-l-index', '7': 'f-r-index', '8': 'f-r-middle', '9': 'f-r-ring', '0': 'f-r-pinky' }; function nextRound() { target = Array.from({length: 8}, () => Math.floor(Math.random() * 10)).join(''); currentIndex = 0; updateUI(); } function updateUI() { displayArea.innerHTML = target.split('').map((c, i) => `<span class="char ${i < currentIndex ? 'correct' : (i === currentIndex ? 'current' : '')}">${c}</span>` ).join(''); const currentNum = target[currentIndex]; // Reset highlights document.querySelectorAll('.key, .finger').forEach(el => el.classList.remove('active')); // Apply new highlights if (currentNum !== undefined) { document.getElementById('k' + currentNum).classList.add('active'); document.getElementById(fingerMap[currentNum]).classList.add('active'); } } window.addEventListener('keydown', (e) => { if (e.key === target[currentIndex]) { currentIndex++; if (currentIndex === target.length) nextRound(); else updateUI(); } }); nextRound(); </script> </body> </html> |