
Stacking certificates
Hover, Images
Someone searched for “palette from image”, “color extractor” and “eyedropper”, and the site found nothing right. Here is the panel of a made-up design app, Hue: a real photo of a beach at dusk and, beside it, five colours actually extracted from its pixels. Hover a colour and only its zones stay lit in the photo while the rest fades to grey, as a marker settles on the spot where that colour is purest. On the photo the eyedropper follows the pointer with a loupe that magnifies the pixels, and the hex underneath rolls digit by digit; a click copies it. Minimal style.
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>
<!--
"Photo palette picker" 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>Palette from a photo</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/jetbrains-mono@5.3.0/index.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<!-- the palette panel of a made-up design app, Hue: five swatches taken from the real pixels of the photo,
the zones of a colour lighting up when you point at its swatch, and an eyedropper with a pixel loupe -->
<section class="card" data-card aria-labelledby="pp-title">
<header class="head">
<span class="brand"><svg viewBox="0 0 18 18" aria-hidden="true"><circle cx="9" cy="9" r="6.2"></circle><path d="M9 2.8v12.4M3.6 6.1l10.8 5.8"></path></svg>Hue</span>
<h1 class="head__title" id="pp-title">Palette from photo</h1>
<span class="head__meta" data-meta>5 colours</span>
</header>
<div class="body">
<div class="photo" data-photo>
<img class="photo__img" src="costa.webp" width="960" height="640" alt="A beach at dusk under a pink sky, with dark rocks and pale sand" data-img>
<canvas class="photo__veil" data-veil aria-hidden="true"></canvas>
<span class="mark" data-mark aria-hidden="true"><span class="mark__ring"></span><span class="mark__dot"></span></span>
<div class="loupe" data-loupe aria-hidden="true">
<canvas class="loupe__px" data-loupe-px width="132" height="132"></canvas>
<span class="loupe__cell"></span>
<span class="loupe__chip"><span class="loupe__sw" data-loupe-sw></span><span class="hex" data-loupe-hex>#000000</span></span>
</div>
<span class="copied" data-copied aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M3.5 8.4l3 3 6-6.6"></path></svg>Copied</span>
</div>
<ul class="swatches" data-swatches aria-label="Extracted colours"></ul>
</div>
<footer class="foot">
<span class="foot__tip"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10.6 2.6l2.8 2.8-1.6 1.6-.9-.9-5.6 5.6H3.5v-1.8l5.6-5.6-.9-.9z"></path></svg>Point at the photo to pick, click to copy</span>
</footer>
</section>
<svg class="ptr" data-ptr viewBox="0 0 24 24" aria-hidden="true"><path d="M5.2 3.4l13 8.2-5.6 1.3 3.3 5.9-2.4 1.3-3.3-5.9-4 4.1z"></path></svg>
<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>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.
23 values to change
Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
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 “Photo palette picker” from Animorio and fit it into my siteOnce the photo has loaded it is drawn onto a small canvas, 160 pixels wide, and read with getImageData. A k-means runs on those pixels with a deterministic start (the mean, then each time the pixel farthest from the centres already chosen) and fourteen passes, with distances weighted like luminance (0.299, 0.587, 0.114): the same photo always gives the same palette. The centres are sorted from lightest to darkest and get a name from their hue and lightness.
For each colour a canvas of the same grid is prepared once: where the pixel belongs to another colour there is a warm grey made from its luminance, as opaque as VEIL, and where it belongs to that colour it stays transparent, with a soft falloff based on distance. On hover the new veil fades in over the old one, which fades out shortly after: no flashes between colours. The canvas is as big as the photo and has the same object-fit: cover.
For each colour the cell closest to its centre is found, with a small penalty for the photo's edges, and saved as a proportion. The marker goes there with back.out (MARK_SPRING), and the position is mapped to the screen with the same object-fit: cover maths, on resize too.
The full photo also sits in a canvas at its own size. On every move the pixel under the pointer is found and LOUPE_PIXELS pixels per side are copied into a round 132 pixel canvas with imageSmoothingEnabled off: the pixels show square. The loupe chases the pointer with quickTo (LOUPE_FOLLOW) and the hex changes by rolling only the digits that differ.
Each hex character is a window one line tall: when it changes, the new digit is added underneath and both rise together over ROLL_TIME, one digit after another; at the end only the new one is left.
| Name | File | Default | What it changes |
|---|---|---|---|
SWATCHES | script.js | 5 | How many colours are extracted from the photo (3 to 6). |
LOUPE_PIXELS | script.js | 11 | How many photo pixels show across the loupe. |
LOUPE_FOLLOW | script.js | 0.16 | How long the loupe takes to catch the pointer, in seconds. |
VEIL | script.js | 0.88 | How much the other colours' zones fade out. |
HIGHLIGHT_TIME | script.js | 0.45 | How long a colour's zones take to light up, in seconds. |
MARK_SPRING | script.js | 1.6 | How far the marker overshoots before settling. |
ROLL_TIME | script.js | 0.38 | How long the hex digits take to roll, in seconds. |
LOOP_PAUSE | script.js | 1.6 | The pause at the end of the tour on its own, in seconds. |
On the site or in the app of a design tool, a palette generator or a photo editor; in a photographer's or illustrator's portfolio, to show the colours of a piece; on a product page selling paints or fabrics from a photo.
In narrow or tall boxes the swatches go under the photo, in a row of five with only the colour and the hex; the photo takes its height in vh. On a phone there is no hover: a tap on the photo shows the loupe and copies, a tap on a swatch lights its zones and copies.
No bounces, rolling digits or chasing loupe: the zones fade in, the marker appears already in place, the loupe sits under the pointer and the tour on its own does not start.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 11 KB; the libraries: GSAP 28 KB.
Tested on 23 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.
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.