190

Stamp Press Headline

£7
or the whole Vault, £99

A rubber stamp effect for headlines and badges: the stamp slams down onto live HTML or SVG text, squashes on impact, dips the page and lifts away, leaving an inked impression with dry patches and rough edges that differ on every press.

advanced
8 more details
text-animationsvg-filterscanvasmicro-interactionscroll-revealkeyboard-navigationreduced-motionprogressive-enhancement

Released

About this effect

A headline or badge that is printed rather than faded in. A rubber stamp arrives from above at speed, squashes for a couple of frames as it hits, the page dips and springs back, and the stamp lifts away more slowly than it came down. What it leaves behind is an inked impression of your own text or SVG: uneven coverage, dry gaps where the rubber did not quite meet the paper, edges that bleed a little, and a faint halo of ink.

Read the full effect overview

Every press is different. Rotation, offset, pressure and the ink texture are randomised within limits you set, and pressure changes the print: a heavy press lands full and bold, a light one patchy and thin. Hold the pointer down and the stamp hovers, lowering as you bear down, then lands harder when you let go. Press again and the new impression lands slightly out of register on top of the old one, which fades back, until a configurable limit clears the oldest.

Stamp Press Headline - GSAP animation effect preview

What's included

12 items
  • Stamp face that drops from above with a fast approach, a one to two frame squash on impact and a slower lift
  • Ink texture generated once per press: dry gaps, mottling and an uneven tilt of pressure across the face
  • Rough, bleeding edges from an SVG displacement filter seeded per press
  • Pressure range: heavy presses print full with a bolder edge, light presses print patchy and thin
  • Hold to press harder: the stamp hovers and lowers while held, then lands with the pressure you built
  • Over-stamping: earlier impressions fade back and new ones land misregistered, up to a maximum before the oldest clears
  • Page dip and recoil on impact plus a faint ink halo, both optional
  • Works on any HTML text, bordered badge or inline SVG seal, including text on a circle
  • Click, tap, scroll-in (once or on every entry), on load in sequence, or from code
  • Ink colour per target, per container or switched at runtime with swatch buttons
  • stamp(), clear(), setInk() and revert() API plus a stamp event carrying the pressure and rotation used
  • Native buttons with Enter and Space, text exposed once to screen readers, reduced-motion fade and plain styled text without JavaScript

Perfect for

4 use cases
  • Approved, paid or shipped states on an order, invoice or checkout confirmation
  • A launch or sale headline that lands with weight instead of fading in
  • Certificates, badges and completion seals in a course or onboarding flow
  • Editorial and campaign pages with a print, postal or bureaucratic look

How it works

2 sections

Your mark stays in the page as ordinary text or SVG; it is what screen readers read and what you edit. On each press the script clones it into an impression layer, then builds that layer's ink once: a small canvas of seeded noise, thresholded by the press pressure and tilted so one side prints heavier, becomes its mask, and a per-press SVG filter roughens and spreads its edges. Nothing is recalculated while it animates.

GSAP runs the press as one short timeline: a second clone acts as the stamp face, dropping and squashing with transforms only, while the surface dips and recoils and older impressions fade back. Each press is scoped to its instance and to the visitor's motion preference, so reduced motion swaps the press for a short fade and one teardown call removes every generated node, filter and listener.

Difficulty Advanced
Includes HTML + JS + CSS source, documentation, AI setup prompt, lifetime updates

Lighthouse, as measured

Google Lighthouse on this effect's demo, from the latest scan. A measurement of the demo as shipped, not a promise for your page.

Accessibility
100
Best practices
100

No performance score, on purpose. That figure depends on how you deploy: your server's compression and caching, your CDN, the connection and the device doing the test, none of which the code controls. The same page can score very differently on two consecutive runs, so measure it where it will live.

The Vault opens this source and the whole library.

Each product gives you the HTML, CSS and JavaScript source, the full documentation and an AI setup prompt, licensed for unlimited personal and commercial projects. Every paid product is tested for desktop and mobile layouts, reduced-motion handling, animation cleanup and keyboard controls wherever there is something to operate.

One payment, over 350 products, and future additions to the library.

Documentation

Quick Start

1. Add to your HTML <head>:

In your downloadThe working code for this step, in index.html.

2. Add before the closing </body> tag:

In your downloadThe working code for this step, in index.html.

3. Add a container with one or more stamp targets:

In your downloadThe working code for this step, in index.html.

The mark is stamped once on load, and again every time it is clicked or tapped.

Using It With Your Own Design

What the effect needs from your markup:

  • A container with data-stamp-press. Options on it apply to every target inside.
  • One or more targets with data-stamp. Use a native <button type="button"> so Enter and Space work and the target is focusable. Any option can also be set on a single target to override the container.
  • Exactly one [data-stamp-mark] inside each target: the text, bordered badge or inline <svg> that gets printed. It stays in the page as the accessible text; the script draws the ink with aria-hidden clones of it, so draw everything in currentColor (text colour, border-color, SVG fill and stroke) and the ink colour follows.
  • Optional controls anywhere on the page: buttons with data-stamp-ink="#1f3a93" switch the ink for later presses, and a button with data-stamp-clear lifts every impression. Point them at a container with aria-controls="container-id"; without it they drive their enclosing container, or every container.

What is only the demo's styling: the purchase-order sheet, Inter, the swatch and Clear button styles, the three stamp-mark--* looks and the dashed empty-slot hint (.is-empty::after) can all be replaced. Zilla Slab is the stamp face in the demo; any heavy slab, stencil or grotesque reads well as a rubber stamp.

CSS the effect depends on:

  • [data-stamp] must be a positioning context with no padding or border (position: relative; display: inline-grid; place-items: center; padding: 0; border: 0). The impressions are laid over the mark at the same size, and padding on the button would offset them.
  • .stamp-impression, .stamp-die, .stamp-die-shadow and .stamp-halo rules must stay: absolute positioning, the negative inset plus matching padding from --stamp-bleed, and the mask-size: 100% 100% that stretches the ink texture over the mark.
  • The pre-hide .has-js [data-stamp] [data-stamp-mark] { opacity: 0 } keeps the plain mark from showing under the ink. It is gated on .has-js, so without JavaScript the mark is shown as normal styled text.
  • Put any slant on the button (rotate: -6deg), not on the mark, so the bleed box rotates with the mark instead of clipping its corners.
  • touch-action: manipulation, user-select: none and -webkit-touch-callout: none on the target keep press-and-hold from selecting text or opening the iOS callout.

Options

Set on the [data-stamp-press] container, or on a single [data-stamp] to override it.

Attribute Values Default Description
data-trigger Any of click, scroll, load, manual, space separated click What presses the stamp. manual (or any value without the others) leaves it to the API.
data-ink Any CSS colour #c8102e Ink colour. A swatch or setInk() overrides it for later presses.
data-rotation Degrees 3 Random rotation range, plus or minus, added to the target's own slant.
data-offset Pixels 4 Random offset range, plus or minus, on each axis. This is what misregisters an over-stamp.
data-pressure min,max from 0.05 to 1.15 0.45,1 Random pressure range. Heavy prints full and bold; light prints patchy and thin.
data-roughness 0 to 3 1 Edge roughness multiplier. 0 gives clean edges, keeping only the ink texture.
data-max-layers Whole number 3 Impressions kept per target. The oldest fades away once this is exceeded.
data-fade 0.1 to 1 0.62 Opacity multiplier applied to each older impression per press on top of it.
data-shake true, false true Dip and recoil the surface on impact.
data-hold true, false true Holding the pointer down builds pressure (full after about one second).
data-scroll-once true, false true With scroll, press only on first entry, or on every entry from either direction.
data-scroll-start ScrollTrigger start top 85% When the scroll trigger fires.
data-load-delay Seconds 0.3 With load, the wait before the first press.
data-load-stagger Seconds 0.4 With load, the gap between targets, in document order.

The surface that dips is the nearest ancestor with data-stamp-surface, or the container itself.

Small marks stay readable. The ink model scales with the size of the mark's primary text (its font size, or for an SVG mark its largest <text> at the size it renders). Below about 56px, the dry patches get finer, the edge roughening and spread get gentler, and the pressure range narrows towards a solid middle. A small seal therefore never loses its date to a light press or fills in its counters on a heavy hold. Large marks keep the full range. Pressures under 0.4 are also eased into 0.32 to 0.4, so even 0.05 prints a readable word. The stamp event reports both the pressure requested and the inkPressure actually printed.

Accessibility

  • Keyboard: every target is a native button, so Tab reaches it and Enter or Space stamps it. :focus-visible draws a ring around the target.
  • Screen readers: the original mark stays in the page and gives the button its name, so the text is read once. Impressions and the stamp face are aria-hidden clones. A polite live region announces each press ("Approved stamped, 2 impressions") and Clear. For an SVG seal, give the button an aria-label.
  • Touch: tap to stamp, press and hold for a heavier press. Long-press does not select text or open the callout or context menu, and the demo's targets are all larger than 44 by 44 pixels.
  • Reduced motion: with prefers-reduced-motion: reduce there is no drop, squash or page dip. The textured impression fades in over a quarter of a second, and load targets are printed immediately. Hold still sets the pressure from how long the pointer was held. Changing the preference while the page is open rebuilds cleanly.
  • No JavaScript: the marks show as ordinary styled text in the ink colour.

Performance

Texture is built once per press, never per frame: a small canvas (at most 340 pixels wide) for the mask and one SVG filter with a tight filter region. During the press only transform and opacity animate. Each impression keeps its filter while it is on screen, so data-max-layers also caps the filter count; keep it low on pages with many targets, as SVG filters are comparatively slow in Safari.

Dependencies

Required:

  • GSAP 3.12+ (the demo is built against 3.15.0)

Optional:

  • ScrollTrigger plugin, only for data-trigger="scroll"

Also in your download: the full source, worked examples, the events and programmatic API, and the class reference.

£7