From 99bfe77b6bf8c759d83c2ae11c1ced79a0175f15 Mon Sep 17 00:00:00 2001 From: Dauren777 Date: Fri, 19 Jun 2026 07:05:08 +0000 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BE=D0=B7=D0=B2=D1=83=D1=87=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B1=D1=83=D0=BA=D0=B2=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20Web?= =?UTF-8?q?=20Speech=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 5f27c18..1e50f4c 100644 --- a/index.html +++ b/index.html @@ -140,6 +140,78 @@ body { color: var(--gray-500); } +.speak-btn { + background: var(--cyan); + color: var(--ink); + border: none; + border-radius: 50%; + width: 36px; + height: 36px; + font-size: 18px; + cursor: pointer; + margin-top: 8px; + transition: all 0.3s; + display: inline-flex; + align-items: center; + justify-content: center; +} + +.speak-btn:hover { + background: #1be5ff; + transform: scale(1.1); +} + +.speak-btn.speaking { + animation: pulse 0.6s infinite; +} + +@keyframes pulse { + 0%, 100% { transform: scale(1); } + 50% { transform: scale(1.2); } +} + +.speak-letter-btn { + background: var(--purple); + color: var(--white); + border: none; + border-radius: 50%; + width: 50px; + height: 50px; + font-size: 24px; + cursor: pointer; + margin-top: 15px; + transition: all 0.3s; + display: inline-flex; + align-items: center; + justify-content: center; +} + +.speak-letter-btn:hover { + background: #7B1FA2; + transform: scale(1.1); +} + +.mirror-speak-btn { + background: var(--pink); + color: var(--white); + border: none; + border-radius: 50%; + width: 60px; + height: 60px; + font-size: 28px; + cursor: pointer; + margin: 15px 0; + transition: all 0.3s; + display: inline-flex; + align-items: center; + justify-content: center; +} + +.mirror-speak-btn:hover { + background: #E91E63; + transform: scale(1.1); +} + /* Mirror Exercise */ .mirror-container { display: flex; @@ -484,7 +556,10 @@ body {

-
Б
+
+
Б
+ +

Как должна выглядеть буква?

@@ -509,6 +584,7 @@ body {
А
+
@@ -636,6 +712,7 @@ function initLetters() { card.innerHTML = `
${item.letter}
${item.sound}
+ `; card.onclick = () => selectLetter(index, card); grid.appendChild(card); @@ -875,6 +952,54 @@ function showFeedback(elementId, message, type) { feedback.style.display = 'none'; }, 3000); } + +// Speech synthesis function +function speakLetter(letter, button) { + // Check if speech synthesis is supported + if ('speechSynthesis' in window) { + // Cancel any ongoing speech + window.speechSynthesis.cancel(); + + // Create a new speech utterance + const utterance = new SpeechSynthesisUtterance(letter); + + // Set language to Russian + utterance.lang = 'ru-RU'; + + // Set rate and pitch for child-friendly speech + utterance.rate = 0.8; // Slower speed + utterance.pitch = 1.2; // Higher pitch for children + + // Add visual feedback + if (button) { + button.classList.add('speaking'); + utterance.onend = () => { + button.classList.remove('speaking'); + }; + utterance.onerror = () => { + button.classList.remove('speaking'); + }; + } + + // Speak the letter + window.speechSynthesis.speak(utterance); + } else { + // Fallback alert if speech synthesis is not supported + alert('Озвучка не поддерживается в этом браузере'); + } +} + +// Speak the current letter in sound game +function speakCurrentSoundLetter() { + const letter = letters[currentSoundLetterIndex]; + speakLetter(letter.letter, null); +} + +// Speak the current mirror letter +function speakMirrorLetter() { + const letter = mirrorLetters[currentMirrorIndex]; + speakLetter(letter.letter, null); +}