Spaces:
Running
Running
Rename scripts.js to script.js
Browse files- scripts.js → script.js +28 -14
scripts.js → script.js
RENAMED
@@ -1,31 +1,45 @@
|
|
1 |
function orderNow() {
|
2 |
-
|
|
|
|
|
3 |
}
|
4 |
|
5 |
function hoverEffect(element) {
|
6 |
-
element.style.transform = "scale(1.05)";
|
7 |
-
element.style.
|
8 |
-
element.addEventListener('mouseout', () => {
|
9 |
-
element.style.transform = "scale(1)";
|
10 |
-
});
|
11 |
}
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
19 |
});
|
20 |
|
|
|
21 |
if ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window) {
|
22 |
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
|
23 |
recognition.lang = 'ru-RU';
|
|
|
24 |
recognition.onresult = (event) => {
|
25 |
-
const command = event.results[
|
26 |
if (command.includes('заказать')) {
|
27 |
orderNow();
|
28 |
}
|
29 |
};
|
30 |
recognition.start();
|
31 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
function orderNow() {
|
2 |
+
const msg = new SpeechSynthesisUtterance("Заказ оформлен! Revolut отправляется к вам.");
|
3 |
+
window.speechSynthesis.speak(msg);
|
4 |
+
alert("Заказ оформлен! Добро пожаловать в эру чистой кожи.");
|
5 |
}
|
6 |
|
7 |
function hoverEffect(element) {
|
8 |
+
element.style.transform = "translateY(-15px) scale(1.05)";
|
9 |
+
element.style.boxShadow = "0 0 20px rgba(0, 255, 204, 0.5)";
|
|
|
|
|
|
|
10 |
}
|
11 |
|
12 |
+
function resetEffect(element) {
|
13 |
+
element.style.transform = "translateY(0) scale(1)";
|
14 |
+
element.style.boxShadow = "none";
|
15 |
+
}
|
16 |
+
|
17 |
+
// Частицы и 3D-анимация продукта
|
18 |
+
document.addEventListener("mousemove", (e) => {
|
19 |
+
const product = document.getElementById("product");
|
20 |
+
const xAxis = (window.innerWidth / 2 - e.pageX) / 25;
|
21 |
+
const yAxis = (window.innerHeight / 2 - e.pageY) / 25;
|
22 |
+
product.style.transform = `perspective(1000px) rotateY(${xAxis}deg) rotateX(${yAxis}deg)`;
|
23 |
});
|
24 |
|
25 |
+
// Голосовое управление
|
26 |
if ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window) {
|
27 |
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
|
28 |
recognition.lang = 'ru-RU';
|
29 |
+
recognition.continuous = true;
|
30 |
recognition.onresult = (event) => {
|
31 |
+
const command = event.results[event.results.length - 1][0].transcript.toLowerCase();
|
32 |
if (command.includes('заказать')) {
|
33 |
orderNow();
|
34 |
}
|
35 |
};
|
36 |
recognition.start();
|
37 |
+
}
|
38 |
+
|
39 |
+
// Приветственное сообщение
|
40 |
+
window.addEventListener('load', () => {
|
41 |
+
if ('speechSynthesis' in window) {
|
42 |
+
const msg = new SpeechSynthesisUtterance("Добро пожаловать в Revolut 2070. Скажите 'Заказать', чтобы начать.");
|
43 |
+
window.speechSynthesis.speak(msg);
|
44 |
+
}
|
45 |
+
});
|