Skip to content
animorio
IT
Back to the library

Restoration before and after

Images, HoverGSAP, CSS onlyMediumCompressed weight: Demo 10 KBGSAP 28 KBFreeDownload the zip

The case study card of a made-up restoration studio, Oake & Vellum: a public domain seventeenth century flower still life split by a glass handle. On the left as it came in, with yellowed varnish, grain, a web of cracks, stains and small losses of paint; on the right as it left. Dragging the handle, the Before and After chips follow on a softer spring, the line catches the light, a loupe riding the line enlarges the detail under it, still split in two, and when you let go the handle settles a pixel past its mark. On its own it gives a tour: the tulip, the roses, the vase and back to the middle.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Restoration before and after" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Before and after of the restoration with the glass handle</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.3.0/opsz-italic.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- the case study card of a made-up painting conservation studio, Oake & Vellum. One real photo of a public domain
         flower still life: on the left the same photo as it came in (yellowed varnish, grain, a web of cracks, stains,
         small losses of paint, all drawn on top in SVG), on the right as it left the studio. A glass handle splits the
         two; the Before and After chips travel with it, the line catches the light, and a loupe rides the line,
         showing the detail under it twice as big, still split in two. -->
    <article class="case" data-case>
      <header class="case__head">
        <span class="case__brand">
          <svg class="case__mark" viewBox="0 0 24 24" aria-hidden="true">
            <path d="M12 2.6c4.1 3 6.4 6 6.4 9.4a6.4 6.4 0 0 1-12.8 0c0-3.4 2.3-6.4 6.4-9.4z"/>
            <path d="M12 7.2v13.2M12 12.6l-3-2.4M12 15.4l3.2-2.6"/>
          </svg>
          <span class="case__studio">Oake <i>&amp;</i> Vellum</span>
        </span>
        <span class="case__chip">Conservation report</span>
      </header>

      <div class="frame" data-frame>
        <div class="plate plate--after" data-after>
          <div class="plate__img"></div>
          <span class="plate__sheen" aria-hidden="true"></span>
        </div>
        <div class="plate plate--before" data-before>
          <div class="plate__img"></div>
          <span class="plate__varnish" aria-hidden="true"></span>
          <svg class="plate__wear" data-wear aria-hidden="true"></svg>
        </div>

        <span class="tag tag--before" data-tag-before aria-hidden="true"><span class="tag__in">Before</span></span>
        <span class="tag tag--after" data-tag-after aria-hidden="true"><span class="tag__in">After</span></span>

        <div class="split" data-split>
          <span class="split__line" aria-hidden="true"><span class="split__glint" data-glint></span></span>
          <div class="loupe" data-loupe aria-hidden="true">
            <div class="loupe__view" data-loupe-view></div>
            <span class="loupe__rim"></span>
          </div>
          <span class="knob" data-knob role="slider" tabindex="0" aria-label="Before and after" aria-valuemin="0" aria-valuemax="100" aria-valuenow="50">
            <span class="knob__glass" data-knob-glass>
              <svg class="knob__icon" viewBox="0 0 16 24" aria-hidden="true">
                <path d="M6 8.5L2.6 12 6 15.5M10 8.5l3.4 3.5-3.4 3.5"/>
              </svg>
            </span>
          </span>
        </div>
      </div>

      <footer class="case__foot">
        <div class="case__title">
          <p class="case__name">Flowers in a Wan-li vase</p>
          <p class="case__meta">Oil on panel, after Bosschaert. Varnish lifted, losses inpainted.</p>
        </div>
        <p class="case__read"><span class="case__pct" data-pct>50</span><span class="case__unit">% cleaned</span></p>
      </footer>
    </article>
    <p class="sr" aria-live="polite" data-live></p>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

27 values to change

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Restoration before and after” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a warm black page sits a dark card with fine grain and a soft layered shadow. At the top the Oake & Vellum mark (a leaf drawn in a thin line, the ampersand in amber italic) and the Conservation report pill. In the middle the real photo of a flower still life in a Chinese vase, striped tulips, roses, daffodils and a butterfly: the right half is clean and full of colour, the left half is the same photo as it was before the restoration, yellowed, darker and flat, under a web of fine cracks with a thread of light along one side, stains with darker tide rings, dust and a few small losses of paint down to the pale ground. Between them a light line with a glass capsule handle near the bottom, and above, on frosted glass, the Before and After chips. A round loupe with a glass rim rides the line and shows the detail under it 2.2 times bigger, split by the line too. Below, in a serif italic, Flowers in a Wan-li vase, the line Oil on panel, after Bosschaert, and on the right the share already cleaned in amber. When the page opens the card rises and lights up, the loupe opens and the handle sets off from the right on its tour: to the striped tulip at the top, to the roses on the right, to the daffodils over the vase and back to the middle, landing each time a pixel too far with the glass squashing and coming back. Dragging the handle, or pressing anywhere on the photo, the line follows the hand closely, the loupe rises and falls with the finger, a band of light lights the line at the loupe's height, brighter with speed, the handle leans with the run, the chips follow on a softer spring and fade when they run out of room; let go, it settles on a spring. On hover the handle and the loupe grow a little.

How it works

One photo, twice

The frame holds two plates of the same size with the same photo in background-size cover. The one below is the after, a touch more saturated; the one above is the before, clipped with clip-path: inset(0 W−x 0 0) up to the handle. There is no real pair of before and after photos, so the before is made from the same photo: a CSS filter (sepia, saturate, brightness, contrast) and an amber varnish layer in mix-blend-mode multiply.

The wear drawn in SVG

Over the before sits an SVG as big as the frame, drawn from a fixed seed: grain with feTurbulence, five stains bent by an feDisplacementMap with their ring, the craquelure made of short broken runs that turn and now and then branch (one dark path and the same one moved 0.6 px in a light tone for the lip that catches the light), small losses of paint and dust. It is drawn again on resize with the new sizes.

A loupe that shows both

The loupe is a circle holding a copy of both plates (cloneNode), scaled by ZOOM from the top left and moved by D/2 − x·ZOOM and D/2 − y·ZOOM. The copy of the before has the frame's own clip-path, so the line splits the enlarged detail too, and a line drawn in the glass rim repeats it.

The springs

Six springs integrated in 1/240 s steps in the GSAP ticker: the line (stiff while dragging, STIFFNESS and DAMPING once let go, so it carries its speed and passes the mark by a pixel), the chips following it more softly, the loupe's height and opening, the squash of the glass (a kick of speed on landing) and the hover. The handle leans by −v·0.006 degrees, and the band of light on the line sits at the loupe's height and grows with speed.

The tour and the keyboard

The tour is a GSAP timeline moving a pilot in shares of the painting (the tulip, the roses, the vase, the middle), turned into frame points with the cover maths: the springs chase it. It repeats until someone touches; at the first touch it stops for good. The handle is a slider: arrows move 5 per cent, with Shift 20, Home and End go to the ends.

Values to change

NameFileDefaultWhat it changes
STARTscript.js0.5Where the handle rests, as a share of the width from the left.
ZOOMscript.js2.2How much the loupe enlarges.
LOUPEscript.js0.34The loupe's size, as a share of the photo's shorter side.
AGEscript.js1How worn the before looks: 0 clean, 1 as it came in.
CRACKSscript.js1How dense the web of cracks is.
STIFFNESSscript.js240The spring that settles the handle when you let go: higher is quicker.
DAMPINGscript.js17Lower lets the handle pass its mark more before it stops.
SPEEDscript.js1The speed of the tour.
LOOPscript.jstrueLeft alone, the tour starts again.

Try them in the Playground

When to use it

For the portfolio of a restoration studio, a photo retoucher, a renovation firm or a cabinet maker, for a before and after of a beauty treatment or an AI retouch: when the comparison is the product and the close up detail matters as much as the whole.

On phones

The same animation with adapted sizes: the card takes almost the whole width, the photo gets shorter with the screen's height, the loupe is a third of the shorter side and the line under the title gets shorter. You drag with your finger, also by pressing anywhere on the photo; the page still scrolls vertically.

With reduced motion

No tour and no springs: the card fades in with the handle in the middle and the loupe open; when dragging, the line, the loupe and the chips go straight to the finger.

Pitfalls

  • The loupe must show exactly what is underneath: the plate copies need the frame's pixel size and the same cover, and they are rebuilt on every resize together with the wear SVG.
  • The before's clip-path inside the loupe is in plate coordinates, not loupe ones: it applies before the scale, with the frame's own value.
  • With transform-origin in the centre the enlarged view drifts: the origin goes top left and the offset is worked out from there.
  • The chips are measured after document.fonts.ready: measured with the fallback font they touch the line.
  • The tour stops only for a real touch: the springs chase the pilot until the first pointerdown arrives.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Newsreader (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 10 KB; the libraries: GSAP 28 KB.

Testing

Tested on 7 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All animations