Skip to content
Back to the lab

Three.js shader + a lens for a transition

Lens-distortion slideshow

A slideshow of four photographs. On a change, a circular lens grows from the centre of the frame with the next picture inside it; the distortion is strongest near the rim and disappears once the circle covers the frame.

Source · GitHub

The shader takes two pictures and one progress value. The circle's radius grows with the progress, and every pixel inside is shifted toward the centre by its closeness to the rim raised to the fifth power, so only a narrow band next to the rim is magnified and the middle is not distorted. Once the radius passes half the diagonal the circle covers the frame, and the rest of the progress removes the magnification. The rim also has a ring of water ripples that weakens with the progress; the original site has it and TTTISE's breakdown does not. Each step of the scroll switches the lens to the next picture; scroll back partway through and the lens shrinks again. Based on Oscar Pico's project slider (oscarpico.es), implemented from TTTISE's breakdown of it.

Source

Source files on GitHub:

Back to the lab