liquid-transitionsGitHub ↗

Open source · WebGL · no dependencies

Images that flow into each other.

One small file adds liquid, ripple and dissolve transitions to any image gallery. If WebGL is missing, the plain image stays. Click the picture, or use the controls.

Hover mode

Set trigger: 'hover' and the picture changes as the pointer enters, then flows back when it leaves. Ripple starts at the pointer.

import { LiquidTransition } from './liquid-transitions.js';

const gallery = new LiquidTransition(document.querySelector('.hero'), {
  images: ['one.jpg', 'two.jpg', 'three.jpg'],
  effect: 'liquid',      // liquid | ripple | dissolve
  duration: 1.1,         // seconds
  intensity: 0.6,        // 0 to 2
  trigger: 'click',      // click | hover | manual
  alt: 'Project gallery',
});

gallery.next();
gallery.goTo(2).then((i) => console.log('now showing', i));
el.addEventListener('liquid:change', (e) => console.log(e.detail.index));