ChaosToggle.js

A small JavaScript library for timed visual effects, pranks, and themed chaos on any page.

Drop in one script tag. Call start() or init(). Effects clean up automatically.

0 dependencies Works on any site No permanent DOM changes

Trust & safety

Built so you can ship surprises without shipping regret.

  • Auto-cleanup. Effects respect a duration and tear down overlays, classes, and timers.
  • No server. Everything runs in the browser. No API calls, no analytics, no backend.
  • No lasting layout damage. DOM tweaks are restored after effects finish; you stay in control of when chaos runs.
  • Scoped targeting. Point chaos at #site-main (as on this page) or any container you choose.

What can you build with this?

Concrete ways teams use ChaosToggle.

Demo environments

Simulate incidents, errors, or “hack” moments for sales and training without touching real data.

Easter eggs

Hide a konami-style payoff on your marketing site or internal wiki.

Launch & milestones

Celebrate releases with confetti and themed particles—then reset in one call.

Hack days & internal tools

Low-risk fun on staging dashboards and team apps.

Presentations

Make a slide or prototype memorable with a timed effect sequence.

Visual stress tests

See how your UI behaves under motion, overlays, and input quirks.

Quick start

Copy, paste, run.

<script src="https://cdn.jsdelivr.net/npm/chaos-toggle@latest/dist/chaos-toggle.min.js"></script>
<script>
  ChaosToggle.start();
</script>
npm install chaos-toggle
import ChaosToggle from 'chaos-toggle';

ChaosToggle.start();

Trigger on key press

ChaosToggle.start({ duration: 3000 });

document.addEventListener('keydown', (e) => {
  if (e.key === 'c') ChaosToggle.trigger();
});

Trigger on button click

ChaosToggle.start();

document.querySelector('#go').addEventListener('click', () => {
  ChaosToggle.runEffect('confetti');
});

Common patterns

Four APIs you will use most often.

Run one effect

ChaosToggle.runEffect('bsod');
ChaosToggle.runEffect('gravity');

Apply a preset mode

ChaosToggle.runMode('nuclear');
ChaosToggle.runMode('demo');

Open the control panel

ChaosToggle.openPanel();

Chain a sequence

ChaosToggle.compose('intro', [
  { effect: 'screenCrack', delay: 0 },
  { effect: 'bsod', delay: 800 },
]);
ChaosToggle.runComposition('intro');

Top picks

Six effects teams reach for first. Explore the full catalog when you need more.

realityTearViewport split with a glowing rift core
bsodFull-screen blue screen prank
gravityLet page elements fall
confettiParticle celebration
glitchOverlayScanline glitch layer
fakeUpdateFake OS update screen
View all 51 effects
EffectCategoryWhat it does
shakeVisualShakes the page (4 animation styles)
glitchOverlayOverlayFull-screen scanline glitch layer
noiseOverlayFilm-grain noise overlay
flashOverlayOverlayPulsing bright flash across viewport
confettiVisualFalling particles (emoji or colored pieces)
zoomFlickerVisualSubtle scale pulse on root
fakeErrorStateVisualDramatic hue-shift like a broken display
matrixRainOverlayFull-viewport katakana digital rain
rgbSplitVisualChromatic aberration across root
vhsDistortionOverlayScanlines, tracking errors, analog skew
screenCrackOverlayShattered-glass fracture lines
pixelDissolveOverlayView explodes into colored pixel storm
realityTearOverlayPage splits into drifting slabs around a glowing dimensional rift
screenMeltVisualViewport drips away with molten edge
crtShutdownVisualVintage CRT display collapse with phosphor flash
bsodPrankFull-screen Windows Blue Screen of Death
fakeUpdatePrankConvincing Windows Update progress screen
fakeTerminalPrankHollywood-style typing terminal overlay
clippyPrankPaperclip assistant with unhelpful suggestions
fakeVirusScanPrankDramatic full-screen antivirus scan UI
fakeCrashPrankChrome-style "Aw, Snap!" crash page
gravityDOMVisible blocks fall with goofy physics
elementShuffleDOMSwaps on-screen positions of elements
elementScatterDOMFlings elements off-screen with spin
textScrambleDOMReplaces text with random characters, then restores
tinyGiantModeDOMRandom elements balloon or shrink
magneticCursorInteractionNearby elements creep toward the pointer
cursorChaosInteractionRainbow crumbs and restless pointer styles
cursorDriftInteractionFake pointer slowly wanders from real one
autoTypoInteractionSneaks extra neighbor keys into text fields
delayedClicksInteractionClicks pause on loading cursor before firing
invertedScrollInteractionWheel direction goes backwards
screenFlipInteractionRotates the whole page upside down
drunkModeInteractionBlurry vision and tipsy wobble
popupsOverlayCorner toast with title and dismiss
springParadeOverlayHopping chicks and eggs parade across the page
starSpangledBannerOverlayPatriotic flags and stars drape across the top edge
hackerHudOverlayFloating status panes and reticle for cyber themes
holidayLightsOverlayFestive lights and ornaments hang across the top edge
hauntedEyesOverlayGlowing eyes peer in from the dark edges of the viewport
retroBroadcastOverlayREC badges, channel bugs, and analog broadcast overlays
partyBalloonsOverlayBirthday banner and balloon bouquet frame the viewport
officeStickyNotesOverlaySticky notes and coffee clutter the page like office desk chaos
evacuationTapeOverlayHazard tape and warnings turn the screen into a disaster zone
midnightBurstOverlayCountdown medallion and fireworks markers celebrate the New Year rollover
harvestTableOverlayA harvest spread of pie, leaves, and candlelight settles along the bottom edge
doorbusterMarqueeOverlayFlash sale ribbons and discount badges turn the screen into a Black Friday rush
protocolGridOverlayNeon rails and checkout telemetry turn the page into a cyber storefront
loveLettersOverlayPinned notes and heart seals wrap the page in Valentine energy
lastCallOverlayNeon bar sign, drinks, and bubbles sway across the viewport
panicAlarmOverlayAlarm braces and warning markers slam into the viewport

Theme showcase

Start with a theme that reads instantly, then decide how aggressive runtime behavior is allowed to be. Everything below is live on this page.

Preview state
Theme default
Policy safe
Last action ready
Holiday theme · low risk

easter

Pastel bounce, chicks, eggs, and a spring parade. It reads playful immediately and stays safe for public-facing pages.

Signature springParade
Best forSeasonal campaigns and internal demos
Recommended policysafe
Holiday theme · celebratory

4th-of-july

Flags, stars, fireworks, and recoil energy. Good when the page should feel like an event, not just a palette swap.

Signature starSpangledBanner
Best forLaunches, event pages, milestone demos
Recommended policydemo
System theme · cinematic

hacker

Binary fallout plus a real HUD layer. This is the right default when you want a “breach” moment that reads instantly.

Signature hackerHud
Best forTraining, incidents, terminal-themed demos
Recommended policydemo
Celebration theme · friendly

birthday

Balloons, party copy, and upbeat motion. Useful when you want obvious celebration with almost no risk to the page.

Signature partyBalloons
Best forRelease notes, ship-day pages, team dashboards
Recommended policysafe
Retail theme · high urgency

black-friday

Doorbuster ribbons and a price-drop center badge make the page feel like a timed sale, not generic glitch.

Signature doorbusterMarquee
Best forPromo pages and event storefronts
Recommended policydemo
Shock theme · stage only

jumpscare

Hard-stop warning treatment for scripted moments. Great for staging and incident theater, wrong for shared production screens.

Signature panicAlarm
Best forControlled demos and explicit prank flows
Recommended policyprank

Mode guide

Policy guide

Set the policy first, then run the theme or mode. The library respects that boundary for theme, mode, and direct effect execution.

View all themes & modes
Holiday
Retail
Vibe

Copy-paste recipes

Opinionated configs you can drop in and tweak.

Office prank

IT department vibes, then panic mode.

ChaosToggle.start({ duration: 4000, theme: 'office' });
ChaosToggle.runTheme('office');
ChaosToggle.runMode('panic');

Halloween horror

Glitch stack on a dark theme.

ChaosToggle.start({ duration: 3500, theme: 'halloween' });
ChaosToggle.runTheme('halloween');
ChaosToggle.runEffect('vhsDistortion');
ChaosToggle.runEffect('noise');

Launch celebration

Ship-it energy, minimal risk.

ChaosToggle.start({ duration: 5000, theme: 'birthday' });
ChaosToggle.runMode('celebration');
ChaosToggle.runEffect('confetti');

Full playground

Browse every effect, theme, and mode with buttons and a live sample area.

Open playground

Advanced capabilities

Deeper than a single script tag—plugins, panel, and types.

Effects, themes, panel, plugins, TypeScript

51 effects

Overlays, pranks, DOM, cursor, and interaction effects—composable and timed.

  • Overlays: Glitch, noise, flash, VHS, CRT, screen crack, RGB split, melt, pixels
  • Pranks: BSOD, fake update, terminal, Clippy, virus scan, crash screen
  • DOM & input: Gravity, shuffle, scatter, scramble, cursor tricks, drunk mode

17 themes

Palettes, particles, overlays, and behaviors bundled per theme.

Holiday, retail, and vibe packs. Override pieces with themeOverrides when you need a custom mix.

Control panel

Floating UI for intensity, duration, effects, and export/import.

  • Open with ChaosToggle.openPanel()
  • Shadow DOM so panel styles never leak into your app
  • Default shortcut: Shift+P runs panic mode (customize with registerShortcut)

Plugins

Package effects, themes, and install hooks.

  • ChaosToggle.registerEffect, registerTheme, compose, on
  • ChaosToggle.use(plugin) to install

TypeScript

Exported types for settings, effects, plugins, and the fluent theme builder.

Use ChaosToggleAPI, ChaosEffect, ChaosPlugin, ThemeProfile, and more from the package.

Zero dependencies

Single bundle with inlined styles. CDN, ESM, or CJS.

No framework required. Drop in and opt in to chaos when you call the API.

Theme builder & hooks

Fluent theme builder

ChaosToggle.buildTheme('office-prank')
  .palette('#0078d7', '#ffb900', '#f0f0f0', '#333')
  .effects('bsod', 'fakeUpdate', 'clippy')
  .particles('confetti', { density: 0.3 })
  .popup({
    title: 'IT Department',
    message: 'Your PC has been compromised.'
  })
  .timing({ durationMultiplier: 2 })
  .register();

ChaosToggle.runTheme('office-prank');

Plugin shape

const myPlugin = {
  id: 'chaos-plugin-office',
  name: 'Office Pranks Pack',
  version: '1.0.0',
  effects: [myCustomEffect],
  themes: [{ id: 'corporate', config: {...} }],
  install(engine) {
    engine.registerShortcut('Shift+B', 'runEffect:bsod');
  },
};

ChaosToggle.use(myPlugin);

Event hooks

ChaosToggle.on('beforeTrigger', () =>
  console.log('Chaos incoming...')
);
ChaosToggle.on('effectStart', (id) =>
  console.log(`Effect: ${id}`)
);

TypeScript imports

import type {
  ChaosEffect,
  ChaosPlugin,
  ChaosToggleAPI,
  ThemeProfile,
  ChaosSettings,
} from 'chaos-toggle';

API & developer experience

Common methods below. See the repository README for the full surface area.

MethodDescription
start(config?) / init(config?)Initialize (aliases; first call wins)
trigger()Fire enabled effects for current theme
reset()Clear active effects and classes
runEffect(id)Run a single effect
runMode(name)Run a preset mode
runTheme(name)Apply and trigger a theme
compose / runCompositionDefine and run timed sequences
openPanel() / togglePanel()Built-in Shadow DOM control panel
registerShortcutKeyboard bindings
use(plugin)Install a plugin package
updateSettingsMerge settings at runtime

Full API on GitHub →

Default shortcuts

ShortcutAction
Shift+HTrigger chaos
Shift+PPanic mode
Shift+RReset
Shift+CCelebration mode

Contributing

New effects, themes, fixes, and docs are welcome.

Effect Theme Bugfix Docs
Contributing guide