mirror of
https://github.com/RedGrox2013/AloeGames-Site.git
synced 2026-07-14 08:01:57 +00:00
115 lines
3.9 KiB
JavaScript
115 lines
3.9 KiB
JavaScript
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.location.href = url;
|
||
}
|
||
|
||
// 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(); |