Spaces:
Running
Running
Update script.js
Browse files
script.js
CHANGED
@@ -1,45 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
function orderNow() {
|
2 |
-
const msg = new SpeechSynthesisUtterance("
|
3 |
window.speechSynthesis.speak(msg);
|
4 |
-
|
|
|
|
|
|
|
5 |
}
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
element.style.
|
|
|
10 |
}
|
11 |
|
12 |
-
function
|
13 |
element.style.transform = "translateY(0) scale(1)";
|
14 |
element.style.boxShadow = "none";
|
15 |
}
|
16 |
|
17 |
-
//
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
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 |
-
});
|
|
|
1 |
+
// Частицы на Canvas
|
2 |
+
const canvas = document.getElementById('particle-canvas');
|
3 |
+
const ctx = canvas.getContext('2d');
|
4 |
+
canvas.width = window.innerWidth;
|
5 |
+
canvas.height = window.innerHeight;
|
6 |
+
|
7 |
+
const particles = [];
|
8 |
+
for (let i = 0; i < 100; i++) {
|
9 |
+
particles.push({
|
10 |
+
x: Math.random() * canvas.width,
|
11 |
+
y: Math.random() * canvas.height,
|
12 |
+
radius: Math.random() * 2 + 1,
|
13 |
+
speed: Math.random() * 1 + 0.5,
|
14 |
+
color: `hsl(${Math.random() * 360}, 100%, 50%)`
|
15 |
+
});
|
16 |
+
}
|
17 |
+
|
18 |
+
function animateParticles() {
|
19 |
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
20 |
+
particles.forEach(p => {
|
21 |
+
ctx.beginPath();
|
22 |
+
ctx.arc(p.x, p.y, p.radius, 0, Math.PI * 2);
|
23 |
+
ctx.fillStyle = p.color;
|
24 |
+
ctx.fill();
|
25 |
+
p.y -= p.speed;
|
26 |
+
if (p.y < 0) p.y = canvas.height;
|
27 |
+
});
|
28 |
+
requestAnimationFrame(animateParticles);
|
29 |
+
}
|
30 |
+
animateParticles();
|
31 |
+
|
32 |
+
// Нейро-анимация продукта
|
33 |
+
document.addEventListener('mousemove', (e) => {
|
34 |
+
const product = document.getElementById('ar-product');
|
35 |
+
const xAxis = (window.innerWidth / 2 - e.pageX) / 20;
|
36 |
+
const yAxis = (window.innerHeight / 2 - e.pageY) / 20;
|
37 |
+
product.style.transform = `perspective(1500px) rotateY(${xAxis}deg) rotateX(${yAxis}deg)`;
|
38 |
+
});
|
39 |
+
|
40 |
+
// Голосовое управление и заказ
|
41 |
function orderNow() {
|
42 |
+
const msg = new SpeechSynthesisUtterance("Revolut активирован. Чистота начинается сейчас.");
|
43 |
window.speechSynthesis.speak(msg);
|
44 |
+
document.body.style.background = "radial-gradient(circle, #00ffcc, #000)";
|
45 |
+
setTimeout(() => {
|
46 |
+
document.body.style.background = "#000";
|
47 |
+
}, 1000);
|
48 |
}
|
49 |
|
50 |
+
// Эффекты для подов
|
51 |
+
function podEffect(element) {
|
52 |
+
element.style.transform = "translateY(-20px) scale(1.1)";
|
53 |
+
element.style.boxShadow = "0 0 30px rgba(0, 255, 204, 0.7)";
|
54 |
}
|
55 |
|
56 |
+
function podReset(element) {
|
57 |
element.style.transform = "translateY(0) scale(1)";
|
58 |
element.style.boxShadow = "none";
|
59 |
}
|
60 |
|
61 |
+
// Нейро-приветствие
|
62 |
+
window.addEventListener('load', () => {
|
63 |
+
if ('speechSynthesis' in window) {
|
64 |
+
const msg = new SpeechSynthesisUtterance("Добро пожаловать в 2070. Активируй Revolut голосом: скажи 'Начать'.");
|
65 |
+
window.speechSynthesis.speak(msg);
|
66 |
+
}
|
67 |
});
|
68 |
|
|
|
69 |
if ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window) {
|
70 |
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
|
71 |
recognition.lang = 'ru-RU';
|
72 |
recognition.continuous = true;
|
73 |
recognition.onresult = (event) => {
|
74 |
const command = event.results[event.results.length - 1][0].transcript.toLowerCase();
|
75 |
+
if (command.includes('начать') || command.includes('активировать')) {
|
76 |
orderNow();
|
77 |
}
|
78 |
};
|
79 |
recognition.start();
|
80 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|