Every December, websites get a bit of falling snow. It's nice, but you just watch it. I wanted the opposite: snow you can throw.

So I made Snowball Fight. Click or tap anywhere on the page and a snowball arcs in from the bottom of the screen, splats against the page and slowly slides down as it melts. Headings and images you hit give a little wobble. And now and then a snowman pops up from the bottom edge, daring you to knock his hat off.

Snowball Fight by Fluri: snowball splats and a snowman on a website

Throw a few: https://fluri.xyz/snowball-fight/

One line to add it to any site:

<script src="https://cdn.jsdelivr.net/npm/@fluritheme/snowball-fight@1/dist/snowball-fight.global.js" data-auto></script> 

"Won't that break my site?"

That was my first worry too. Only clicks on empty parts of the page throw a snowball. Links, buttons, form fields, videos and anything focusable work exactly as before, and selecting text never throws. If that still feels like too much, trigger: "button" means snowballs only fly from a small button in the corner.

A few details I enjoyed building

  • The splat is generated fresh every time: a squashed core, 7 to 11 lumps around it, a handful of streaks shooting outwards ending in droplets, and loose specks. A soft blue shadow keeps it visible on white pages.
  • The sliding. After about a second, most splats start creeping down the page, leaving a fading wet smear above them, then melt away after 30 seconds. Some just stay stuck, like real snow on a window.
  • The wobble uses the Web Animations API with composite: "add", so it rotates the element you hit without wiping out any transform it already has.
  • The snowman is drawn on the canvas, no images. Hit him and his hat spins off with real gravity, for 3 points and a "Bullseye!"

Turn it into a little game

There's a hit counter in the corner, and you can unlock a reward for good aim:

import { createSnowballFight } from "@fluritheme/snowball-fight"; createSnowballFight({ hitsForReward: 5, message: "Great aim! Here's 10% off.", code: "SNOWBALL10", }); 

Every hit fires a fluri-snowball-hit event, if you want to count hits in your analytics (I'm curious how many people play).

It respects prefers-reduced-motion, has no dependencies, and the whole thing is free and MIT-licensed.

It's part of Fluri, my collection of playful website effects. There's also a no-code version for WordPress, Shopify and Wix.

How many hits did you get? Did you get the snowman?

npm: https://www.npmjs.com/package/@fluritheme/snowball-fight