Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/dev-haunt/llms.txt
Use this file to discover all available pages before exploring further.
BatSwarm fills the background of every DevHaunt page with a small flock of animated bats. It is a purely decorative, always-on effect: the bats are positioned fixed to the viewport, set to pointer-events: none, and stacked below page content so they never obscure anything interactive. Each bat is an independent Framer Motion <motion.div> with randomised speed, delay, vertical offset, and scale — so the swarm feels organic rather than mechanical.
How it works
On mount, auseEffect call generates an array of bat configuration objects using Array.from({ length: 4 }). Each object captures a random snapshot of:
top— vertical start position (5–35%of viewport height)duration— crossing time (15–25 s)delay— stagger before the first loop starts (0–10 s)scale— apparent size (0.5–1.0×)
Animation
Each bat uses two simultaneous Framer Motion animation tracks on itsx and y axes:
xtrack — linear sweep from-100pxoff the left edge to120vwoff the right edge, then loops.lineareasing keeps the horizontal speed constant.ytrack — a multi-keyframe sequence that bobs the bat up and down erratically witheaseInOuteasing, mimicking the fluttering flight path of a real bat.
duration and delay, they never cross the screen in lockstep.
SVG bat shape
Each bat is rendered as an inline SVG (40×20 viewBox, fill: #051f25) made up of three paths:
#051f25 is slightly darker than the night background (#0b3a44) so the bats are visible as silhouettes without demanding attention.
Positioning and stacking
Bats start at
left: -100px (off-screen left) and animate to 120vw (off-screen right). The container’s overflow: hidden clips them at both edges for a clean entry and exit.Customisation
| Property | Location | Default |
|---|---|---|
| Number of bats | Array.from({ length: 4 }) | 4 |
| Speed range | Math.random() * 10 + 15 | 15 – 25 s |
| Vertical range | Math.random() * 30 + 5 | 5 – 35 % |
| Size range | Math.random() * 0.5 + 0.5 | 0.5 – 1.0 × |
| Bat colour | fill on <svg> | #051f25 |
| Vertical bob path | y keyframe array | [0,-20,10,-10,0,-30,20,0] |
Lifecycle
BatSwarm runs continuously for as long as Layout is mounted. Because all animations use repeat: Infinity, there is no idle state — bats are always in flight. The component has no teardown logic beyond the standard React unmount, at which point Framer Motion stops all animations automatically.