Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/apursley2012/magical/llms.txt

Use this file to discover all available pages before exploring further.

BackgroundEffects is the ambient visual layer of the Magical Portfolio. It renders a position: fixed, full-screen div sitting behind all page content at z-index: -1, giving every route a consistent, living backdrop without impacting layout or scroll behaviour.
This component accepts no props. Its particle layout — positions, sizes, durations, and delays — is randomised on mount using useEffect, so each page load produces a unique arrangement.

What It Renders

The component layers three distinct visual elements on top of a solid bg-mystic-950 base:

1. Noise Texture Overlay

An inline SVG <feTurbulence> filter with type="fractalNoise" is applied as a full-size overlay at 3% opacity. This adds a subtle grain to the background, breaking up the flatness of the dark base and giving the canvas an organic, hand-crafted feel.

2. Radial Gradient Glows

Two large, blurred radial gradient blobs add depth and colour to the canvas:
GlowPositionApproximate sizeColour
Violet blobTop-left50 vwMystic violet
Teal blobBottom-right60 vwMystic teal
Both blobs are blur-filtered circles rendered as absolutely-positioned div elements inside the fixed container. They remain stationary and serve as the warm ambient light sources that particles drift through.

3. Floating Particles

40 individual particles are generated on mount and animated independently. Each particle is a small, circular div with the following randomised properties:
PropertyRange
X position0–100% of viewport width
Y position0–100% of viewport height
Size1–4 px (width & height)
Colourbg-mystic-mint/40
Animation duration10–30 seconds
Animation delay0–5 seconds
Each particle drifts upward across the screen and fades out as it travels, then loops infinitely. The combination of varied durations and delays means the particle field never appears to cycle in unison — the motion stays organic and continuous.

Z-Index Positioning

The root container uses z-[-1], placing the entire background layer beneath the React Router page tree. Individual elements within the component stack naturally without interfering with interactive UI above.

Performance Notes

  • Particle data (positions, sizes, timing) is computed once inside a useEffect on mount and stored in state, so no recalculation happens on re-renders.
  • All particle animations are CSS/Framer Motion keyframe loops — they run entirely on the compositor thread and do not trigger JavaScript on each frame.
  • The noise texture is a lightweight inline SVG filter rather than an external image asset, keeping the initial load lean.

Usage

Add <BackgroundEffects /> once near the root of your component tree, outside the main content wrapper so it spans the full viewport:
import { BackgroundEffects } from './components/BackgroundEffects';

<BackgroundEffects />

Build docs developers (and LLMs) love