feat(interaction): implement sophisticated hover effects and parallax

- Add moving shine effect and glow on card hover
- Implement coffee drip animation for link underlines
- Add JS-driven parallax scroll effect for floating elements
- Enhance button micro-interactions
- Refine animations for smoothness
This commit is contained in:
2026-02-12 09:19:20 -05:00
parent 87505afd68
commit 8883b5487b
2 changed files with 85 additions and 13 deletions

27
main.js
View File

@@ -154,6 +154,32 @@ function initTestimonials() {
});
}
// ===== PARALLAX EFFECT FOR DECORATIVE ELEMENTS =====
function initParallax() {
const floatingElements = document.querySelectorAll('.floating-bean, .floating-cup');
if (!floatingElements.length) return;
let ticking = false;
window.addEventListener('scroll', () => {
if (!ticking) {
window.requestAnimationFrame(() => {
const scrolled = window.scrollY;
floatingElements.forEach((el, index) => {
const speed = 0.05 + (index * 0.02); // Vary speed per element
const yPos = -(scrolled * speed);
// Use CSS variable to avoid overwriting the float animation transform
el.style.transform = `translateY(${yPos}px)`;
});
ticking = false;
});
ticking = true;
}
}, { passive: true });
}
// ===== INITIALIZE ALL =====
document.addEventListener('DOMContentLoaded', () => {
initTypewriter();
@@ -161,4 +187,5 @@ document.addEventListener('DOMContentLoaded', () => {
initSkillBars();
initParticles();
initTestimonials();
initParallax();
});