Overview
This module automatically initializes animations on page load (unless the user prefers reduced motion) and handles:- Hero section entrance animations
- Scroll-triggered section reveals
- Works accordion animations
- Skills tag animations
- Contact section animations
- Chatbot section animations
Installation
The animations are automatically initialized when the DOM is ready:Functions
initHeroEntrance()
Animates the hero section with a staggered entrance timeline, including badge, title words, name letters with bounce effect, waving emoji, description, photo slider, and CTAs. Location:src/scripts/animations.js:9
Usage:
.badget- Badge with scale and fade-in (0.4s, back.out easing)[data-animate="word"]- Title words with slide and rotation (0.5s, stagger 0.1s).name .letter- Name letters falling with bounce (0.6s, stagger 0.04s)[data-animate="wave"]- Wave emoji with rotation animation (0.4s + repeat).hero-description- Description fade-in (0.5s).photo-sliderorimg- Photo with scale animation (0.7s).ctas- Call-to-action buttons fade-in (0.5s)
initScrollReveal()
Reveals sections with a fade-up animation as they enter the viewport during scroll. Location:src/scripts/animations.js:134
Usage:
[data-reveal] attribute. The function animates children of [data-reveal-inner] if present, otherwise animates direct children.
Animation Properties:
Initial opacity value
Initial vertical offset in pixels
Animation duration in seconds
Delay between animating child elements
- Trigger point:
top 80%(when section is 80% from viewport top) - Toggle actions:
play none none none
initWorksReveal()
Animates the works section heading and accordion items with staggered entrance. Location:src/scripts/animations.js:157
Usage:
.works .heading- Section heading (0.7s, y: 40).works .accordion .accordion-item- Accordion items (0.7s, y: 60, stagger: 0.15s)
.works section reaches 80% from viewport top.
initSkillsReveal()
Animates skill tags with scale and stagger effect as they enter the viewport. Location:src/scripts/animations.js:198
Usage:
.skills .heading- Section heading (opacity: 0, y: 40, 0.7s).skills .tagschildren - Individual skill tags (opacity: 0, y: 30, scale: 0.8, stagger: 0.04s)
- Duration: 0.5s per tag
- Easing:
back.out(1.2)for a slight overshoot effect - Stagger: 0.04s between tags
- Heading triggers at
top 80% - Tags trigger at
top 85%
initContactReveal()
Animates contact section elements (heading, subline, and links) with staggered fade-up. Location:src/scripts/animations.js:238
Usage:
.contact .heading- Section heading.contact .subline- Subtitle.contact .links .link- Individual contact links
- Opacity: 0 to 1
- Y offset: 30px
- Duration: 0.6s
- Stagger: 0.1s between elements
initChatbotReveal()
Animates the chatbot section with heading, subline, and chat container entrance. Location:src/scripts/animations.js:266
Usage:
.chatbot-section .heading- Heading (y: 40, 0.7s).chatbot-section .subline- Subline (y: 30, 0.6s, delay: 0.1s).chatbot-section .chat-container- Chat container (y: 50, scale: 0.95, 0.8s, delay: 0.2s)
back.out(1.2) easing for a subtle bounce effect.
init()
Main initialization function that checks for reduced motion preference and initializes all animations. Location:src/scripts/animations.js:320
Usage:
- Checks
prefers-reduced-motionmedia query - Skips all animations if user prefers reduced motion
- Automatically called on DOMContentLoaded or immediately if DOM is already loaded
initHeroEntrance()initScrollReveal()initWorksReveal()initSkillsReveal()initChatbotReveal()initContactReveal()
Dependencies
- GSAP (GreenSock Animation Platform)
- ScrollTrigger (GSAP plugin)
Accessibility
The module respects user preferences for reduced motion:Example Usage
To add scroll reveal to a custom section:Performance Considerations
- Uses
requestAnimationFramefor smooth animations - ScrollTrigger optimizes scroll performance
- Animations only play once (
toggleActions: 'play none none none') - Automatically disabled for users with motion sensitivity