02.14 · Entrance & Exit

Shatter Effect

Breaks into pieces that fly apart and fade. Best for galleries and bold exits.

Watch it

It plays by itself. Turn on slow motion to follow each piece as it flies.

Try it

Change a setting and the animation plays again.

Number of pieces

More pieces look like thinner glass; phones cut Many a little coarser.

Breaks from

The break starts there, and the nearest pieces fly first.

Gravity

With none, the pieces drift away instead of falling.

More optionsFewer options

Speed

How long the pieces take to fly and fade.

Cracks spread across the card a moment before it breaks.

The pieces flip toward you instead of spinning flat.

Copy the prompt

Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.

Add a shatter effect to [the card or picture you want to break]. When it plays, the card breaks into uneven pieces that burst away from the point of impact, each turning as it flies and fading out, while the next card fades in behind them. Make each piece a copy of the whole card trimmed to its own shape, so together they look exactly like the card until they move, and launch the pieces nearest the impact first. Move and turn the pieces rather than resizing them so it stays smooth, and remove them once they have faded. If the visitor has reduced motion turned on, fade the card out and the next one in, with no pieces. Match the settings listed below.

Replace the words in brackets with your own element. Your settings are added at the end.

Free and open source. If this helped, a star on GitHub helps other people find it.

Star on GitHub

What it is

The full explanation is in README.md.

Good for

  • Photo galleries
  • Dismissed cards
  • Game moments
  • Bold intros

Avoid on

  • Things shown often
  • Calm, serious pages