Commit 657d0ef
authored
Update README.md
// Efecto typewriter mejorado
function initTypewriter() {
const elements = document.querySelectorAll('.type');
elements.forEach((el, index) => {
const text = el.textContent;
const delay = parseInt(el.getAttribute('data-delay')) || index * 1000;
el.textContent = '';
el.style.opacity = '0';
setTimeout(() => {
el.style.opacity = '1';
let i = 0;
const typing = setInterval(() => {
if (i < text.length) {
el.textContent += text[i];
i++;
} else {
clearInterval(typing);
}
}, 50);
}, delay);
});
}
// Sistema de partículas
function initParticles() {
const canvas = document.getElementById('particles');
const ctx = canvas.getContext('2d');
// Configurar canvas
function resizeCanvas() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
resizeCanvas();
window.addEventListener('resize', resizeCanvas);
// Partículas
const particles = [];
const particleCount = 50;
class Particle {
constructor() {
this.x = Math.random() * canvas.width;
this.y = Math.random() * canvas.height;
this.vx = (Math.random() - 0.5) * 0.5;
this.vy = (Math.random() - 0.5) * 0.5;
this.size = Math.random() * 2 + 1;
this.opacity = Math.random() * 0.5 + 0.2;
}
update() {
this.x += this.vx;
this.y += this.vy;
// Wrap around edges
if (this.x < 0) this.x = canvas.width;
if (this.x > canvas.width) this.x = 0;
if (this.y < 0) this.y = canvas.height;
if (this.y > canvas.height) this.y = 0;
}
draw() {
ctx.beginPath();
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
ctx.fillStyle = `rgba(0, 212, 255, ${this.opacity})`;
ctx.fill();
}
}
// Crear partículas
for (let i = 0; i < particleCount; i++) {
particles.push(new Particle());
}
// Animación
function animate() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
particles.forEach(particle => {
particle.update();
particle.draw();
});
// Conectar partículas cercanas
particles.forEach((p1, i) => {
particles.slice(i + 1).forEach(p2 => {
const dx = p1.x - p2.x;
const dy = p1.y - p2.y;
const distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 100) {
ctx.beginPath();
ctx.moveTo(p1.x, p1.y);
ctx.lineTo(p2.x, p2.y);
ctx.strokeStyle = `rgba(0, 212, 255, ${0.1 * (1 - distance / 100)})`;
ctx.stroke();
}
});
});
requestAnimationFrame(animate);
}
animate();
}
// Scroll suave
function initSmoothScroll() {
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
}
// Inicializar cuando el DOM esté listo
document.addEventListener('DOMContentLoaded', function() {
initTypewriter();
initParticles();
initSmoothScroll();
// Mensaje de bienvenida en consola
console.log('%c🤖 MechMind-dwv System Initialized', 'color: #00D4FF; font-size: 20px; font-weight: bold;');
console.log('%c🚀 Welcome to the future of robotics!', 'color: #00FF88; font-size: 14px;');
});1 parent e897efa commit 657d0ef
File tree
0 file changed
+0
-0
lines changed0 file changed
+0
-0
lines changed
0 commit comments