Vanilla Disintegratev1.0.0
EN

Remove any element
with a Thanos snap

A lightweight TypeScript library for removing and restoring any DOM element with a Thanos-snap effect. Choose one of four ready-made animations or create your own — with no CSS and no framework lock-in.

npm install vanilla-disintegrate @zumer/snapdom
Try it with real DOM
Live Thanos snap

Snap it away. Bring it back.

Every card is a real DOM element. Pick an animation, remove a card, then restore that same card from the list below.

Custom effect

Create your own snap.

This particle vortex is a completely custom animation. Try removing and restoring the card, then see how the pair is defined.

Real codeOne effect, two animations

Define what happens when the element disappears and what happens when it comes back.

import Disintegrator from 'vanilla-disintegrate/snapdom';

import { particleVortex } from './particle-vortex';

const effects = new Disintegrator();
const element = document.querySelector<HTMLElement>('.card')!;
const container = element.parentElement!;

const removal = effects.remove(element, {
  effect: particleVortex,
  retain: true,
});
await removal.finished;

const restored = removal.removalId === null ? null : effects.take(removal.removalId);
if (restored !== null) {
  container.append(restored);
  await effects.restore(restored, { effect: particleVortex }).finished;
}
Build a custom effect
Documentation

Start simple. Add more when needed.

Begin with one remove() call. Then learn how to restore elements, build undo, preload screenshots, or create a custom effect.