
Squared paper under the photo
Hover, WebGL, Images
The eyedropper of a made-up colour app, Tincture, built as a real glass lens in WebGL: you drag it over a real photo of a mountain lake at dusk, inside it magnifies and bends the picture with a thin rainbow on the rim, it stretches when you move it fast and springs back round; let go, it picks the colour underneath and you add it to the palette.
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>
<!--
"Glass lens 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 glass lens you drag over the photo</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/standard.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage" data-stage>
<section class="card" data-card aria-label="Colour picker">
<header class="card__top">
<p class="brand"><svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true"><path d="M10 2.5c3.2 3.6 5 6.3 5 8.6a5 5 0 0 1-10 0c0-2.3 1.8-5 5-8.6Z" /></svg><span data-brand>Tincture</span></p>
<p class="card__file">ridge-at-dusk.png</p>
</header>
<div class="photo" data-photo>
<img class="photo__img" data-img src="crinale.webp" alt="A mountain lake at dusk, pink peaks and pines mirrored in the still water" width="1024" height="680" decoding="async">
<canvas class="photo__gl" data-gl aria-hidden="true"></canvas>
<p class="photo__hint" data-hint>Drag the lens to pick a colour</p>
</div>
<footer class="pick">
<div class="pick__now">
<span class="chip" data-chip aria-hidden="true"><span class="chip__shine"></span></span>
<div class="pick__text">
<p class="pick__label">Picked</p>
<p class="pick__hex" data-hex aria-live="polite">#000000</p>
</div>
</div>
<div class="palette" data-palette aria-label="Palette">
<span class="slot" data-slot></span><span class="slot" data-slot></span><span class="slot" data-slot></span><span class="slot" data-slot></span>
</div>
<button class="add" type="button" data-add>
<svg class="add__icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 3v10M3 8h10" /></svg>
<span class="add__label" data-addlabel>Add</span>
</button>
</footer>
</section>
</main>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
<script src="script.js"></script>
</body>
</html>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.
19 values to change
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 “Glass lens photo” from Animorio and fit it into my siteThe photo is a real file in the demo folder, crinale.webp, 1024 × 680, shown as an <img> with object-fit: cover. Once it has loaded it is copied once into a canvas: its pixels become the lens texture and are also used to read the colour. The WebGL canvas sits over the <img>, so the photo is already visible before the texture is ready.
Photo and lens live in a single WebGL quad. Inside the radius the point is read at the centre plus the distance divided by the zoom, and the closer to the rim the further it is pushed back along the normal (the distance cubed), as in a glass sphere; the three channels are read slightly apart only near the rim (fourth power), and that is where the rainbow comes from. On top, a fresnel that lightens the rim, a Gaussian highlight top left and a shadow shifted down outside the glass.
The lens does not go where the finger is: it chases it on a spring (acceleration = distance × SPRING, velocity damped to 0.62 per frame). Speed, in radii per frame, becomes the stretch, up to STRETCH: in the shader the point is rotated into the direction of travel, divided by 1 + s along it and by 1 − 0.38 s across it.
The colour is the average of 5 × 5 photo pixels under the centre, two pixels apart, with the coordinates carried into the photo as in background-size: cover. While moving the square changes every frame and the hex every 90 milliseconds without animation; on release the changed digits roll one after another with back.out and the square bounces from 0.84.
Add makes a copy of the square and flies it in two moves, first up and sideways turning eight degrees, then down to the free slot while shrinking; once there, the slot fills and bounces from 1.25. The autopilot moves a fake finger with a repeating timeline and empties the palette each loop; a real touch stops it and it restarts after eight quiet seconds.
| Name | File | Default | What it changes |
|---|---|---|---|
BRAND | script.js | 'Tincture' | The name of the made-up app, written top left. |
ZOOM | script.js | 1.9 | How much the lens magnifies the photo at its centre. |
LENS_SIZE | script.js | 0.21 | The lens radius, as a share of the photo’s short side. |
BEND | script.js | 0.2 | How much the rim of the glass bends the photo. |
PRISM | script.js | 0.006 | The chromatic aberration on the rim: the three colours splitting. |
STRETCH | script.js | 0.34 | How much the lens stretches when you drag it fast. |
SPRING | script.js | 0.2 | The spring that brings the lens under the finger: higher is quicker. |
HOLD | script.js | 2.2 | The seconds the autopilot stays on a colour before moving on. |
For a design app, a palette tool or a product configurator: the lens shows things up close and tells what is being picked. Also as a toy on a landing page, where you touch the product instead of looking at it.
The same lens under a finger: the photo is sized on width and height, the lens on its short side, and the file name disappears under 420 pixels to make room for the palette.
The lens goes straight where you touch, with no spring and no stretch; the colour changes without rolling and the squares fade into the palette instead of flying.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.2 KB; the libraries: GSAP 28 KB.
Tested on 6 November 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.