Files
AloeGames-Site/html/js/app.js
T
2026-05-19 21:41:43 +03:00

115 lines
3.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
let currentLang = 'en';
const translations = {
en: {
title: 'We Build Worlds',
desc: 'AloeGames is a modern game development studio focused on creating immersive, next-generation experiences.',
button: 'Explore',
aboutTitle: 'About Us',
aboutText: 'We are a team of passionate developers, designers, and dreamers. Our mission is to push the boundaries of interactive entertainment and deliver unforgettable gaming experiences.',
projectsTitle: 'Our Projects',
contactTitle: 'Contact',
contactText: 'Get in touch with us for partnerships, collaborations, or just to say hello.'
},
ru: {
title: 'Мы создаём миры',
desc: 'AloeGames — современная игровая студия, создающая захватывающий игровой опыт нового поколения.',
button: 'Смотреть',
aboutTitle: 'О нас',
aboutText: 'Мы команда разработчиков, дизайнеров и мечтателей. Наша цель — расширять границы интерактивных развлечений и создавать незабываемые игры.',
projectsTitle: 'Наши проекты',
contactTitle: 'Контакты',
contactText: 'Свяжитесь с нами для сотрудничества или просто чтобы сказать привет.'
}
};
function toggleLang() {
currentLang = currentLang === 'en' ? 'ru' : 'en';
const t = translations[currentLang];
tryToggleTextContent('title', t.title);
tryToggleTextContent('desc', t.desc);
tryToggleTextContent('button', t.button);
tryToggleTextContent('aboutTitle', t.aboutTitle);
tryToggleTextContent('aboutText', t.aboutText);
tryToggleTextContent('projectsTitle', t.projectsTitle);
tryToggleTextContent('contactTitle', t.contactTitle);
tryToggleTextContent('contactText', t.contactText);
}
function tryToggleTextContent(elementId, textContent) {
let el = document.getElementById(elementId);
if (el != null)
el.textContent = textContent;
}
function searchQuery(event) {
event.preventDefault();
const engine = document.getElementById('searchEngine').value;
const query = document.getElementById('searchInput').value.trim();
if (!query) {
document.getElementById('searchInput').focus();
return;
}
const encodedQuery = encodeURIComponent(query);
let url = 'https://www.google.com/search?q=' + encodedQuery;
if (engine === 'duckduckgo') {
url = 'https://duckduckgo.com/?q=' + encodedQuery;
} else if (engine === 'perplexity') {
url = 'https://www.perplexity.ai/search?q=' + encodedQuery;
}
window.open(url, '_blank', 'noopener');
}
// Background animation
const canvas = document.getElementById('bgCanvas');
const ctx = canvas.getContext('2d');
function resize() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
window.addEventListener('resize', resize);
resize();
const particles = [];
for (let i = 0; i < 80; i++) {
particles.push({
x: Math.random() * canvas.width,
y: Math.random() * canvas.height,
vx: (Math.random() - 0.5) * 0.5,
vy: (Math.random() - 0.5) * 0.5,
size: Math.random() * 2 + 1
});
}
function animate() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
particles.forEach(p => {
p.x += p.vx;
p.y += p.vy;
if (p.x < 0 || p.x > canvas.width) p.vx *= -1;
if (p.y < 0 || p.y > canvas.height) p.vy *= -1;
ctx.beginPath();
ctx.arc(p.x, p.y, p.size, 0, Math.PI * 2);
ctx.fillStyle = 'rgba(34,197,94,0.8)';
ctx.shadowBlur = 10;
ctx.shadowColor = 'rgba(34,197,94,0.8)';
ctx.fill();
ctx.shadowBlur = 0;
});
requestAnimationFrame(animate);
}
animate();