I released an open-source library called @hdcodedev/snowfall. It adds a snowfall effect to React applications where the snow interacts with the page content.
Most snowfall effects just overlay the screen. This one uses physics so the snowflakes actually land and accumulate on your HTML elements (headers, cards, buttons, etc.).
It includes:
- Physics: Wind, gravity, and collision detection.
- Accumulation: Snow piles up on elements and eventually melts.
- Smart Detection: You can use
data-snowfallattributes or let it auto-detect semantic tags.
It’s easy to drop into a project:
npm install @hdcodedev/snowfall
import { Snowfall, SnowfallProvider } from '@hdcodedev/snowfall';
export default function App() {
return (
<SnowfallProvider>
<Snowfall />
{/* Snow will accumulate on this element */}
<header>
<h1>Winter Mode</h1>
</header>
</SnowfallProvider>
);
}
The source code and docs are on GitHub:
github.com/hdcodedev/snowfall
Live demo:
next-snowfall.vercel.app
Top comments (0)