Skip to content
animorio
IT
Back to the library

Colour temperature slider

Images, HoverCanvas, GSAPMediumCompressed weight: Demo 15 KBGSAP 28 KBFreeDownload the zip

The white balance panel of a made-up raw photo editor, Kestrel Raw, dark and polished like a Dribbble shot: on top a real photo of a mountain lake at dawn with a long pale granite rock in the water, drawn on a canvas, below it the Temperature and Tint sliders. Dragging them the light of the whole photo changes live, from cold blue to amber, the Kelvin roll on their strips of digits, the RGB histogram slides and the glow under the card takes the photo's colour. With the eyedropper you touch the pale rock, the point that should be grey, and the photo corrects itself.

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>
<!--
  "Colour temperature slider" 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 colour temperature slider of the photo with the eyedropper</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="stage">
    <!-- the white balance panel of a raw photo editor, Kestrel Raw. The photo (lago.webp, a real CC0 photo of a lake at
         dawn under a granite shore, a long pale rock in the water) is drawn on a canvas and shown through the white balance: drag Temperature and Tint and the
         light of the whole picture shifts live, the Kelvin roll, the RGB histogram slides and the glow under the card
         takes the photo's colour. The eyedropper picks a neutral point: the pale rock, and the photo corrects itself -->
    <div class="wb" data-wrap>
      <span class="wb__spill" data-spill aria-hidden="true"></span>
      <article class="wb__card" data-card>
        <div class="wb__photo" data-photo>
          <canvas class="wb__canvas" data-canvas aria-label="A lake at dawn with a long pale rock in the water" role="img"></canvas>
          <canvas class="wb__ghost" data-ghost aria-hidden="true"></canvas>
          <span class="wb__sheen" aria-hidden="true"></span>
          <span class="wb__chip" aria-hidden="true">
            <span class="wb__chip-face" data-state>As shot</span>
            <span class="wb__chip-face" data-state>Custom</span>
            <span class="wb__chip-face" data-state>Picking</span>
            <span class="wb__chip-face" data-state>Neutral</span>
          </span>
          <span class="wb__histo" aria-hidden="true"><canvas data-histo></canvas></span>
          <span class="wb__pulse" data-pulse aria-hidden="true"></span>
          <span class="wb__picker" data-picker aria-hidden="true">
            <span class="wb__ring" data-ring><span class="wb__ring-dot" data-ring-dot></span></span>
            <svg class="wb__pipette" viewBox="0 0 24 24">
              <path class="wb__pipette-body" d="M14.6 4.6l4.8 4.8M16.4 3.2a2.1 2.1 0 0 1 3 0l1.4 1.4a2.1 2.1 0 0 1 0 3l-2 2-4.4-4.4 2-2zM13.9 7.1l3 3-7.6 7.6-3.4.4.4-3.4 7.6-7.6z"/>
              <path class="wb__pipette-tip" d="M5.9 18.1L3.6 20.4"/>
            </svg>
          </span>
          <span class="wb__exif" aria-hidden="true">24 mm&nbsp;&nbsp;f/5.6&nbsp;&nbsp;1/250</span>
        </div>

        <header class="wb__head">
          <span class="wb__titles">
            <span class="wb__title">White balance</span>
            <span class="wb__file">DSC_0418 in Kestrel Raw</span>
          </span>
          <span class="wb__tools">
            <button class="wb__reset" type="button" data-reset>Reset</button>
            <button class="wb__drop" type="button" data-drop aria-label="Pick a neutral point" aria-pressed="false">
              <span class="wb__drop-face" data-drop-face>
                <svg viewBox="0 0 24 24" aria-hidden="true">
                  <path d="M14.6 4.6l4.8 4.8M16.4 3.2a2.1 2.1 0 0 1 3 0l1.4 1.4a2.1 2.1 0 0 1 0 3l-2 2-4.4-4.4 2-2zM13.9 7.1l3 3-7.6 7.6-3.4.4.4-3.4 7.6-7.6z"/>
                  <path d="M5.9 18.1L3.6 20.4"/>
                </svg>
              </span>
            </button>
          </span>
        </header>

        <div class="wb__ctl">
          <div class="wb__row">
            <span class="wb__name">Temperature</span>
            <span class="wb__val" data-kelvin aria-hidden="true"></span>
          </div>
          <div class="wb__track wb__track--temp" data-track="temp" role="slider" tabindex="0" aria-label="Temperature"
               aria-valuemin="2000" aria-valuemax="12000" aria-valuenow="5200">
            <span class="wb__rail" aria-hidden="true"></span>
            <span class="wb__notch" data-notch aria-hidden="true"></span>
            <span class="wb__thumb" data-thumb="temp" aria-hidden="true"><span class="wb__thumb-face" data-face="temp"></span></span>
          </div>
        </div>

        <div class="wb__ctl">
          <div class="wb__row">
            <span class="wb__name">Tint</span>
            <span class="wb__val wb__val--tint" data-tint aria-hidden="true">0</span>
          </div>
          <div class="wb__track wb__track--tint" data-track="tint" role="slider" tabindex="0" aria-label="Tint"
               aria-valuemin="-40" aria-valuemax="40" aria-valuenow="0">
            <span class="wb__rail" aria-hidden="true"></span>
            <span class="wb__notch wb__notch--mid" aria-hidden="true"></span>
            <span class="wb__thumb" data-thumb="tint" aria-hidden="true"><span class="wb__thumb-face" data-face="tint"></span></span>
          </div>
        </div>
      </article>
    </div>
    <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.

30 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 “Colour temperature slider” 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 near black page a dark card with round corners rises slowly, its 1px edge catching the light at the top. On top is the photo, a real one: a mountain lake at dawn, the sky getting lighter, a granite wall with pines, and in front a long pale rock mirrored in the still water. Over the photo three frosted glass capsules: on the left the state (‘As shot’), on the right a small histogram with the red, green and blue channels, at the bottom the settings ‘24 mm f/5.6 1/250’. The photo starts cold, a little blue, as it came out of the camera. Below, ‘White balance’, the file name, the Reset button and the eyedropper button; then the Temperature slider (blue to amber, with a notch at the shot value) and Tint (green to magenta), each with a white thumb holding a small dot of the colour it is giving the photo. On its own the demo takes the temperature thumb, which swells with a halo, and moves it to 3300 K: the photo turns night blue; then to 9600 K, amber; then it leaves it on a warm look and the thumb goes back to its size on a spring. Each time the Kelvin roll digit by digit, the histogram slides and the glow under the card changes colour. Then the eyedropper lights up amber, a white ring appears on the photo showing the colour under it, glides over the lake and settles on the rock: a tap, the ring tightens, a thin wave leaves the point, and the two sliders run by themselves to where the rock turns grey, around 7000 K with the tint close to zero. The capsule says ‘Neutral’. Then Reset brings everything back as shot and the loop starts again. You can drag the sliders, use the arrow keys and touch any point of the photo with the eyedropper.

How it works

The photo drawn once

The photo (lago.webp, a real CC0 photo) is drawn once on an offscreen canvas, cropped like object-fit: cover and a little below the middle, to keep the rock and its reflection. It is redrawn only when the box changes size, and the point of the rock is worked out again from the crop.

White in two passes

At each change the photo is composed again: the original, then with multiply a rectangle in the colour of the three gains (red and blue opposite for the temperature, green for the tint), then the original again in luminosity mode at 60%, which brings the light back without taking the colour away. So the photo changes tone without going dark.

The eyedropper solves the grey

The eyedropper reads the original under the ring (an average of a few pixels with getImageData) and solves backwards the gains that make red and blue equal, then green: out come the Kelvin and the tint. On the granite rock, a little blue at dawn, they come out as about 7000 K and a tint close to zero.

Springs and digits

The values chase their target on a spring integrated by hand in two steps per frame, both when the demo moves them on its own (a GSAP timeline moving the target) and under the finger. The Kelvin are five columns of digits from 0 to 9: each column turns toward its digit the shortest way.

Histogram and glow

The same composition on a small canvas, 96 by 64, gives the pixels for the histogram (40 bins per channel, smoothed, drawn with lighter), the colour under the ring and the average that tints the glow under the card through a CSS variable.

Values to change

NameFileDefaultWhat it changes
AS_SHOTscript.js5200The Kelvin the camera wrote: the photo starts here, a little cold.
AS_SHOT_TINTscript.js-9The tint the camera wrote (minus is green).
STRENGTHscript.js1How strongly temperature and tint colour the photo.
LIFTscript.js0.6How much of the original photo's light is laid back over the colour (0 = darker).
STIFFNESSscript.js210The spring of the thumbs: higher is quicker.
DAMPINGscript.js21Lower lets the thumbs pass the mark and come back.
SPEEDscript.js12 = the walk on its own twice as fast, 0.5 = half.
LOOPscript.jstrueRepeats the walk.

Try them in the Playground

When to use it

For the site of a photographer or a retouching studio, the page of a photo app or a photography course, a portfolio that wants to show its colour work: a real panel you can touch.

On phones

The same animation with adapted sizes: the card is almost as wide as the box, the photo gets lower with the height, the thumbs are dragged with a finger and the eyedropper takes the point you touch.

With reduced motion

No running thumbs or flying rings: the photo goes from one balance to the next with a fade (as shot, warm, neutral) and the values are already in place; under the finger the sliders and the eyedropper work the same.

Pitfalls

  • Multiply on its own darkens the photo the stronger the colour: the luminosity pass with the original brings the light back and keeps the tone.
  • The eyedropper has to read the original, not the corrected photo: otherwise every tap corrects the correction and the values run away.
  • The rolling digits are not moved by GSAP in percent (it does not read them back): the script writes their position every frame, as a percentage of the strip.
  • Opened from a file (file://) the photo taints the canvas and getImageData is blocked: the photo is still drawn and coloured, and the histogram, the glow and the eyedropper read a table of 32 by 20 colours measured once from the photo and written in the script.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 15 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