Skip to content
animorio
IT
Back to the library

Snap-to-corner photo

Images, TransitionsGSAPMediumCompressed weight: Demo 6.0 KBGSAP 28 KBFreeDownload the zip

A minimal image animation with one gesture: taking a photo. A real photograph, an orange sunset with a low sun over the hills, drifts slightly like a camera held by hand; press the shutter and the disc sinks and springs back, a thin tomato-red stroke runs around the ring, the photo gives a little kick and flashes white, and a copy of that very moment shrinks into the bottom corner on a spring, tilting, gaining a white edge and a soft shadow, still bright from the flash. Then it slides away, as if saved.

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>
<!--
  "Snap-to-corner photo" 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>The photo that snaps into the corner</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="scena" data-stage>
    <div class="palco" data-palco>
      <!-- the live view: one real photo, a sunset over the hills, drifting a little like a camera held by hand -->
      <div class="mirino" data-frame>
        <div class="mirino-kick" data-kick>
          <div class="foto" data-photo>
            <img data-scene src="tramonto.webp" alt="A warm sunset: a full sun low over layers of dark hills" width="960" height="640" decoding="async">
          </div>
          <!-- the flash of the shutter -->
          <span class="lampo" data-flash aria-hidden="true"></span>
        </div>
      </div>
      <!-- the mode of the camera; when a photo lands it reads Saved for a moment -->
      <p class="modo" aria-live="polite"><span class="modo-riga" data-mode>Photo</span><span class="modo-riga modo-salvata" data-saved>Saved</span></p>
      <!-- the shutter: a thin ring and a disc; a stroke runs around the ring while the photo is taken -->
      <button class="scatto" data-shutter data-autoclic type="button" aria-label="Take a photo">
        <svg class="scatto-anello" viewBox="0 0 60 60" aria-hidden="true">
          <circle class="anello-fondo" cx="30" cy="30" r="28.5"/>
          <circle class="anello-giro" data-ring cx="30" cy="30" r="28.5"/>
        </svg>
        <span class="scatto-disco" data-disc></span>
      </button>
    </div>
    <!-- the thumbnails are added here by the script -->
  </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.

18 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 “Snap-to-corner photo” 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 empty warm white sits a real photograph with rounded corners: a sunset, the orange sky darkening to red, the low sun white and full, and rows of hills ever darker down to an almost black foreground, under a fine film grain. It is live: the photo drifts slowly along an arc as in a pan, breathes in and out by a hair and trembles by a pixel, like a camera held by hand. Underneath is the shutter, a thin ring with a black disc inside. On the shot the disc sinks and springs back, a thin tomato-red stroke runs around the ring and fades, the photo shrinks by a breath and comes back and flashes white, then stays a touch darker for a moment, like an eye adjusting, and gets its light back. Out of the flash comes a copy of that very moment, framed exactly as it was right then: it shrinks towards the bottom left corner on a spring that passes the mark by a pixel, tilts a few degrees and straightens halfway, gains a white edge and a soft shadow, drops a pixel and settles; meanwhile its colours, still bright from the flash, come back full. After two seconds the thumbnail steps back and slides away to the left, fading, as if saved to the gallery, and soon the next shot is taken, with the framing a little further on. Under the photo the word Photo, in tomato red, gives way to a grey Saved when the thumbnail lands, and comes back when it leaves. Tap the shutter or the photo to take one whenever you like.

How it works

A live, real photo

The photo is a real image (tramonto.webp, 960 by 640) inside a 5 by 4 frame with overflow hidden, with object-fit cover and a little bigger than the frame, so the drift never shows its edge. A repeating GSAP tween runs a number from 0 to 1 in 15 seconds and every frame writes the image transform with gsap.set: xPercent and yPercent on a slow arc, a breathing scale and a one-pixel tremble made of two sines at different frequencies. On top, still, a film grain in SVG (feTurbulence) hides the banding of the sky.

A copy of that moment

On the shot the script clones the photo frame with cloneNode: since the movement lives in the transform written on the image, the copy is exactly that frame, grain included, with nothing redrawn. The copy loses its data-scene and its alt text, because it is a duplicate.

Flying into the corner on a spring

The copy starts on top of the photo, with sizes read from getBoundingClientRect, and goes to the corner animating left, top, width, height, padding and radius with a hand-written ease: a damped spring (ratio from 1 to 0.68 depending on BOUNCE) that passes the mark by a pixel. That way the white edge stays thin and is not blown up by a scale.

Flash, kick, ring

The flash is a white veil that rises in 45 milliseconds and falls in half a second; the photo shrinks to 0.986 and comes back with back.out; the shutter disc drops to 0.8; the stroke on the ring is a stroke-dashoffset going from 179 to 0. The copy starts at brightness 1.55 and comes back to 1 in a second, as if still dazzled. Right after the flash the live photo starts at brightness 0.86 and comes back to 1 in 0.9 seconds, like an eye adjusting.

The loop

A gsap.delayedCall shoots every 3.6 seconds; the thumbnail leaves after two seconds of rest with a step back and a slide to the left. A new shot sends the old thumbnail away at once; on resize the thumbnails go back to their corner.

Values to change

NameFileDefaultWhat it changes
INTERVALscript.js3.6Seconds between one shot and the next, when left alone.
HOLDscript.js2Seconds the thumbnail rests in the corner.
THUMB_SIZEscript.js0.27The width of the thumbnail, as a share of the photo.
TILTscript.js-2The tilt of the thumbnail, in degrees.
FLASHscript.js0.85How white the flash gets, from 0 to 1.
BOUNCEscript.js0.5How far the thumbnail passes the mark before it settles.
DRIFTscript.js1How much the live photo drifts (0 = still).
SPEEDscript.js12 = twice as fast, 0.5 = half as fast.
LOOPscript.jstrueKeep taking photos on its own.

Try them in the Playground

When to use it

For a camera or photo editing app, for the page of a photographer or a studio, for an app’s screenshot tool, for a shop that saves a product photo or for a guest at an event taking a souvenir photo.

On phones

The same animation with adapted sizes: the photo is as big as the box allows, in width and height, and you shoot with a finger.

With reduced motion

No flights, springs or drifting photo: on every shot a light flash and the thumbnail fading in already in its corner and fading out the same way.

Pitfalls

  • If the thumbnail shrinks with a scale, the white edge turns hair-thin too: animate the real sizes, on a single element.
  • If the live photo moves without being bigger than its frame, every step of the pan shows the edge: scale it up at least as much as it moves (here 1 + 0.08 times DRIFT, for a pan of at most 2.6%).
  • A sunset is almost all gradient and banding shows in a compressed webp: save the photo at high quality and lay a light grain on top.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 6 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