src/styles/global.css.
Animation System Overview
The animation system provides:- 3 keyframe animations:
marquee,fade-up,spin - Tailwind v4 utilities via
@themedirective - Extended config in
tailwind.config.mjsfor shadcn compatibility
Animation utilities are defined in both
@theme (Tailwind v4) and tailwind.config.mjs (shadcn compatibility). See Theme System for details on this architecture.Keyframe Definitions
All keyframes are defined at the bottom ofsrc/styles/global.css:
Marquee Animation
Infinite horizontal scrolling effect for skill badges and logos.src/styles/global.css
- Translates element from 0% to -50% horizontally
- Designed for duplicated content (displays 2 copies, scrolls 1 full width)
- Seamless infinite loop when content is repeated
Fade-Up Animation
Subtle entrance animation with opacity and vertical translation.src/styles/global.css
- Starts invisible (
opacity: 0) and 20px below final position - Animates to full opacity and natural position
- Used for staggered entrances on page load
Spin Animation
Continuous 360° rotation for loading indicators.src/styles/global.css
- Simple full rotation
- Typically used with
infiniteiteration - Standard loading/spinner animation
Tailwind v4 Animation Utilities
Animation utilities are defined in the@theme directive:
src/styles/global.css
animate-marquee
Duration: 30s
Timing: linear
Iteration: infiniteFor infinite scrolling content
Timing: linear
Iteration: infiniteFor infinite scrolling content
animate-fade-up
Duration: 0.5s
Timing: ease
Fill: bothFor entrance animations
Timing: ease
Fill: bothFor entrance animations
animate-spin
Duration: 0.7s
Timing: linear
Iteration: infiniteFor loading spinners
Timing: linear
Iteration: infiniteFor loading spinners
Usage Examples
Marquee in Skills Section
Infinite scrolling skill badges fromsrc/components/Skills.astro:
src/components/Skills.astro
animate-marqueecreates infinite scrollhover:[animation-play-state:paused]pauses on hover[...skills, ...skills]duplicates content for seamless loopmask-imagecreates fade-out edges
The marquee requires duplicated content (
[...skills, ...skills]) to create a seamless infinite loop. The animation translates -50%, so the second copy appears as the first exits.Fade-Up in Hero Section
Staggered entrance animations fromsrc/components/Hero.astro:
src/components/Hero.astro
- First element:
0sdelay (no delay) - Second element:
0.1sdelay - Third element:
0.2sdelay - Fourth element:
0.3sdelay
Custom Animation Syntax
The hero uses arbitrary value syntax for custom timings:Extended Configuration
Thetailwind.config.mjs extends keyframes and animations for shadcn compatibility:
tailwind.config.mjs
Adding Custom Animations
To add a new animation:Animation Modifiers
Tailwind provides utility classes to modify animations:Animation Play State
Control whether animations are running or paused:Animation Delay
Use arbitrary values for custom delays:Animation Duration
Customize animation duration:Animation Best Practices
Use semantic utilities
Prefer
animate-fade-up over arbitrary keyframe valuesStagger entrances
Use delays (0.1s, 0.2s, 0.3s) for cascading effects
Keep durations short
0.3s-0.6s feels snappy; >1s feels sluggish
Use ease timing
ease or ease-out feels more natural than linearProvide pausing
Use
hover:[animation-play-state:paused] for accessibilityTest on slow devices
Ensure animations don’t cause jank on lower-end hardware
Accessibility Considerations
Respect user preferences for reduced motion:src/styles/global.css
Consider adding this media query to respect users who prefer reduced motion. This is important for accessibility and reducing motion sickness.
Performance Tips
Use transform & opacity
These properties are GPU-accelerated and performant
Avoid animating layout
Don’t animate
width, height, margin, padding - use transform insteadUse will-change sparingly
Only add
will-change: transform if you notice jankTest with DevTools
Use Chrome DevTools Performance tab to profile animations
Related Resources
Theme System
Learn about the @theme directive and configuration
Color Tokens
Complete color token reference