The constants module centralizes timing, thresholds, and configuration values used throughout the application. These values control interactive behaviors, network detection, and animations.
Using a single source of truth for magic numbers provides:
The module exports four const objects, each grouping related values:
DELAYSDebounce delays and timing values in milliseconds:
CONSOLE_LOGO_DEBOUNCE (1000ms) — Prevents duplicate ASCII logo prints in consolePROJECT_HOVER_VIDEO (1000ms) — Delay before showing video on project card hoverAVATAR_SNEEZE_DEBOUNCE (100ms) — Debounce for avatar hover interactionsSTAR_ANIMATION_INITIAL (1000ms) — Initial delay for forced star shooting animationsUsage: Import to control debouncing and timing in components.
THRESHOLDSTrigger thresholds for interactive features:
SNEEZE_TRIGGER_INTERVAL (5) — Number of hovers before avatar sneeze animationAAAAHHHH_TRIGGER_COUNT (6) — Number of sneezes before Easter egg activationMIN_STARS_FOR_ANIMATION (15) — Minimum stars required before forcing animationUsage: Import to control when interactions trigger animations or Easter eggs.
NETWORKNetwork performance thresholds for adaptive loading:
SLOW_DOWNLINK_THRESHOLD (1.5 Mbps) — Maximum speed considered slowFAST_RTT_THRESHOLD (100ms) — Maximum round-trip time considered fastSLOW_NETWORK_TYPES ([‘slow-2g’, ‘2g’, ‘3g’]) — Network types always considered slowUsage: Import in isNetworkFast() to determine whether to autoplay videos.
ANIMATIONSMulti-stage animation durations in milliseconds:
SNEEZE_STAGE_1 (500ms) — First frame of avatar sneezeSNEEZE_STAGE_2 (300ms) — Second frame of avatar sneezeSNEEZE_STAGE_3 (1000ms) — Final frame of avatar sneezeUsage: Import to sequence the avatar sneeze animation in Avatar component.
Implementation: src/constants/index.ts