Skip to content

Getting started

RageLayer is a self-contained page-destruction toy: it rasterizes the live page into a destructible canvas, hides the real DOM (layout and scroll survive), and lets visitors smash, shoot, burn, soak, saw, paint, corrode, bomb — and then sweep it all up. Zero assets, zero runtime dependencies, framework-agnostic core with a drop-in React component.

The demo page mid-destruction

Install

Install from npm:

sh
npm install ragelayer

Bun, pnpm and Yarn all work the same way (bun add ragelayer, …).

The package ships modern ESM with TypeScript declarations. react/react-dom are optional peer dependencies — you only need them for the ragelayer/react entry.

60-second React setup

tsx
import { useState } from "react";
import { RageLayer } from "ragelayer/react";

function App() {
  const [open, setOpen] = useState(false);
  return (
    <>
      <button onClick={() => setOpen(true)}>Destroy this page</button>
      {open && <RageLayer onClose={() => setOpen(false)} />}
    </>
  );
}

That's the whole integration: a floating toolbar appears, the page becomes destructible, and Esc (or the ✕ button) restores everything and unmounts cleanly.

Next.js note: use it from a Client Component. The published React entry preserves its "use client" boundary; lazy loading is optional. See integrations.

60-second vanilla setup

ts
import { createRageLayer } from "ragelayer";

const rageLayer = createRageLayer({
  initialTool: "flamethrower",
  soundEnabled: true,
});

document.querySelector("#destroy")?.addEventListener("click", () => rageLayer.toggle());

The controller registers all 16 tools and handles repeated open/close cycles. Build whatever UI you like on top—the live demo is a complete example with a hand-rolled toolbar.

The toolset

Base tools (7)

ToolGesture
🔨Hammerclick — escalating blows until the spot fractures into rigid debris
🔫Gunclick / hold for full-auto
🔥Flamethrowerhold — fire catches, spreads and eats the page
💦Water Hosehold — a compact pressure nozzle douses fire and washes stains
🪚Chainsawdrag — close a loop and the piece drops out whole
🎨Paintballclick once or hold for automatic fire
🧹Broomdrag — sweeps damage away and repairs content

Heavy tools (5)

ToolGesture
🏗️Demolitionclick — knocks a real page element loose as one object
🚀Rocket launcherclick
Lightningclick
🕳️Black holehold — lenses the page, eats debris, detonates on release
🐛Bugclick — releases a bug that gnaws trails through the page

Advanced tools (4)

ToolGesture
🔫Gravity Gunhold to pull debris, release to launch it
🔴Laser Cutterdrag — makes a clean structural cut and drops isolated pieces
🧪Acid Sprayerhold — aligned corrosion creeps slightly around each deposit
💣Sticky Bombsclick — attaches a timed charge

Screenshots and detailed behavior notes: tool gallery.

Need a smaller initial graph or different visual sizing? See procedural 3D models for toolScale, engine-only imports, base/heavy/advanced tool entry points, and on-demand loading.

Keyboard (React toolbar)

19/0 select tools · X collapse the page · P save a PNG · R repair · M mute · Esc deselect, then close.

Where next

Released under the MIT License.