Open Source

SeasonalOverlaysLibrary

A dependency-free JavaScript library for brief, full-viewport particle overlays — snow, fireworks, falling leaves, confetti, hearts, Pride-month rainbows, a flying cat with a rainbow trail, and your own custom icons — triggered by a click, or automatically from a seasonal calendar.

No download needed — link to it directly:

<script src="https://seasonaloverlayslibrary.stuxapis.net/seasonal-overlays-library.js"></script>

Try it

Every button below is wired with nothing but a data-overlay-preset attribute — no JS was written for this demo grid.

● Single ● Multi ● Calendar ● Special — see what these mean below.

This page runs SeasonalOverlaysLibrary.auto() on load, in infinite mode — today's calendar preset, right now, running until you hit Stop or the tab is closed. Every month has a default preset (see the calendar below), so there's almost always something falling.

Preset types

The dots on each button above, and the badges below, mark which of these apply — a preset can be more than one.

● Single

A preset with one fixed look — no seasons or include to pick from. Most presets are this. You can still reskin colours, size, speed, etc. via the full options.

● Multi

A composable preset built from named sub-elements you can pick and combine: leaves (via seasons) and halloween or christmas (via include). Leave the option out and you get a sensible default combination.

● Calendar

A preset that the default seasonal calendar resolves to for at least part of the year — what you'll get from preset: 'auto' on the matching date. auto itself is tagged here too, since it's the calendar's entry point.

● Special

Doesn't fit Single/Multi/Calendar: random isn't a look of its own — it picks a random preset and jitters its values each time. codebug is a deliberate easter egg, not a real theme. Both are opt-in only, never picked by auto or random itself.

Usage

Both wiring methods work at once — use whichever fits, or mix them.

<button data-overlay-preset="fireworks">Celebrate</button>
<button data-overlay-preset="fireworks" data-overlay-random-colors>Celebrate (random)</button>
<button data-overlay-preset="snow" data-overlay-infinite>Let it snow</button>
<button data-overlay-preset="leaves" data-overlay-seasons="spring,winter">Two seasons at once</button>
<button data-overlay-preset="halloween" data-overlay-include="pumpkins,skulls">No ghosts</button>
<img src="/assets/tile.png" data-overlay="/assets/pumpkin.png" alt="Spooktober">

<script src="https://seasonaloverlayslibrary.stuxapis.net/seasonal-overlays-library.js"></script>

Any clickable element works — an <img>, a <button>, a <div>. Click delegation means it also picks up elements added to the page later.

SeasonalOverlaysLibrary.start({ preset: 'leaves' });
SeasonalOverlaysLibrary.start({ preset: 'snow', durationMs: null }); // infinite
SeasonalOverlaysLibrary.start({ imageUrl: '/assets/pumpkin.png' });  // fully custom, no preset
SeasonalOverlaysLibrary.start({ preset: 'random' });                 // a surprise every time
SeasonalOverlaysLibrary.stop();                                     // stop an infinite run
// Resolves today's date against the calendar and starts that preset.
SeasonalOverlaysLibrary.auto();

// Or let a trigger resolve it at click time:
// <button data-overlay-preset="auto">Surprise me</button>

// Replace the calendar with your own (checked in order, first match wins):
SeasonalOverlaysLibrary.calendar = [
  { startMonth: 6, startDay: 1, endMonth: 6, endDay: 30, preset: 'rainbows' },
  { startMonth: 12, startDay: 1, endMonth: 12, endDay: 31, preset: 'snow' }
];

Presets

snow

Small white circles, drifting straight down, no rotation.

snowflakes

❄ glyphs, slow fall with gentle rotation.

leaves

🍁🍂🍃 glyphs, wide drift and tumbling rotation. Defaults to autumn — pass seasons to pick/combine spring, summer, autumn, winter. leavesSpring, leavesSummer, leavesAutumn and leavesWinter are each a single season on their own (all Single, and leavesAutumn also Calendar).

confetti

Small coloured squares, fast fall, heavy rotation.

fireworks

Repeating radial bursts of coloured sparks — an explode-and-fade, not a fall. Pass colors for your own palette, or randomColors: true for every spark to get its own random hue.

pumpkins

🎃 glyphs, gentle fall. Halloween.

skullsghosts

💀👻 glyphs, gentle fall with tumbling rotation. Halloween.

halloween

Combines pumpkins/skulls/ghosts, picked via include (default: all three) — e.g. include: ['pumpkins'] for just pumpkins.

christmas

Candy canes, snowballs and snowflakes by default, picked via include. trees 🎄 and gifts 🎁 are also available but opt-in.

hearts

Heart emoji, gentle fall. Valentine's.

eastereggs

🥚🐣🐰 glyphs, gentle fall with tumbling rotation. Easter (April).

rainbows

Squares in the six classic Pride-flag colours, fast fall. Pride month.

nyancat

A sprite (🐱 by default) flying across the screen trailing a rainbow. Bring your own art via imageUrl — see the note below.

codebug

Easter egg: the actual mojibake text produced during development by a missing charset header, plus a few classic bug values.

random

Picks a random preset (never codebug) and jitters its count/size/duration, occasionally swapping in randomColors too. Every trigger can land on a Single, Multi, or Calendar preset.

Default seasonal calendar

What preset: 'auto' / SeasonalOverlaysLibrary.auto() resolves to, out of the box — every month has one, so there's (almost) always something. Replace SeasonalOverlaysLibrary.calendar to define your own.

WhenPreset
Jan 1–2fireworks
Jan 3–31snow
Feb 1–14hearts
Feb 15–28snow
Marchconfetti
Aprileastereggs
Mayconfetti
Junerainbows
Jul 1–5fireworks
Jul 6–31confetti
Augustconfetti
Septemberleaves
Oct 1–24pumpkins
Oct 25–31skullsghosts
Novemberleaves
Decembersnow

Full options reference

Passed to SeasonalOverlaysLibrary.start(options), or set as a preset default.

OptionWhat it does
presetName of a built-in preset, or 'auto' to resolve today's date against the calendar.
imageUrlSingle custom icon image URL (shorthand for icons: [imageUrl]).
iconsArray of image URLs; each particle picks one at random.
contentArray of text glyphs (e.g. emoji); each particle picks one at random. Always wins over seasons or include if set explicitly.
seasonsleaves only: which season(s) to combine into content — any of spring, summer, autumn, winter.
includehalloween or christmas only: which element(s) to combine into content. halloween: pumpkins, skulls, ghosts. christmas: candyCanes, snowballs, snowflakes, trees, gifts.
colorsCSS colors for plain-shape particles, and the text colour for non-emoji glyphs.
randomColorstrue = every particle gets its own random hue instead of picking from colors.
shapecircle | square — used when no icons/content given.
behaviorfall (default) | burst (radial explosion, repeats) | fly (crosses the screen, optional trail).
countParticles per fall batch, per firework burst, or flying sprites.
minSize / maxSizeParticle size in px.
minDuration / maxDurationSeconds per particle (fall/fly), or per burst.
driftMax horizontal drift in vw over the fall (fall only).
rotateWhether particles spin as they fall (fall only).
burstIntervalMsGap between fireworks bursts (burst only, default 900).
trail / trailColorsWhether a fly particle leaves a fading trail, and its colours (fly only).
zIndexStacking order. Default 9999.
durationMsHow long the effect runs before auto-cleanup. Default 2200. Pass null for infinite.

A note on "nyancat"

The actual Nyan Cat sprite/GIF is a specific copyrighted character, not something this library bundles. The nyancat preset gives you the mechanic — a sprite flying across the screen trailing a rainbow — defaulting to a 🐱 emoji. Pass your own licensed art via imageUrl if you have one:

SeasonalOverlaysLibrary.start({ preset: 'nyancat', imageUrl: '/assets/your-own-sprite.gif' });