Skip to the content

Pixel image trail

Images settle along the path of the cursor, then leave again.

Become a member to unlock the full effect today.

Join now

Already a member? Sign in

Documentation

  1. Copy to Webflow

    Add Geist and Geist Mono to your site's fonts (Site settings, Fonts, Google Fonts) before pasting: Webflow removes any font your site has not installed.

  2. Add custom CSS

  3. Add custom JS

  4. Tune it

    Custom attributes
    Select the section on the canvas and open the Settings panel. Under Custom attributes, add a pair: the name on the left, the value on the right.
    Custom attributeWhat it does
    data-pixel-trail Marks the section the effect plays on. It takes no value: leave the value field empty.
    data-pixel-trail-images Marks the hidden box holding the images the trail draws. Without it the engine takes every image inside the section, wherever it sits. [ Optional ]
    data-images A comma separated list of picture addresses, read only when the section holds no img at all. With images in the markup it is ignored. [ Optional ]
    Settings
    Every setting is a custom attribute too, added the same way and on the same section. An attribute always wins over the defaults written in the code.
    AttributeDefaultWhat it is
    data-accent #ffab1a Flash colour carried by the pixel front. Options: any CSS colour; taken out of this block, --pixel-trail-accent on the section then the page's --accent take over.
    data-width clamp(170px, 15vw, 300px) Width of one card laid down along the cursor, any CSS unit.
    data-height clamp(222px, 19.6vw, 392px) Height of that same card, the picture being cropped to fill it.
    data-cell 18 Side of one square the image is composed from, kept in px so the grain is the same on every screen.
    data-sweep 0.35 How much the order of the squares follows a diagonal rather than chance, 0 to 1.
    data-appear 0.32 How long a card takes to compose square by square, in seconds.
    data-hold 0.6 How long the card stays whole before it breaks up, in seconds.
    data-vanish 0.46 How long the card takes to break up square by square, in seconds.
    data-front 0.06 How long a square stays lit by the accent as the front passes over it, in seconds.
    data-front-intensity 1 Strength of the accent light carried by that front, 0 to 1.
    data-flat 1 How solid the lit squares are, 0 to 1.
    data-min-distance 115 Distance the cursor travels between two cards, any CSS unit.
    data-drift 26 How far a card glides along the direction of travel while it lives, any CSS unit.
    data-max-rotation 9 Random tilt given to each card, in degrees.
    data-pool 16 Cards alive at the same time.

What it does

Pixel image trail is a cursor animation for Webflow and vanilla JavaScript, with no library. Also called image trail, pixel trail cursor or cursor image trail effect.

Images settle along the path of the cursor, then leave again. None of them appears in one piece: each one composes cell by cell, like an image being loaded, and decomposes the same way as it goes out. The pixel front lights up in the accent tint just before laying the image down, and again just before putting it out, which reads as a render in progress rather than a plain fade. An image is only dropped once a certain distance has been travelled, so the trail follows the speed of the gesture: slow, it leaves a few crisp images; fast, it leaves a scarf of fragments. Each image drifts a little along the direction of travel and carries a slight rotation. Everything is painted into a single canvas laid over the content; each image also keeps its own, off-screen, where only the cells that change get redrawn. An image trail pattern, digital-decomposition flavour.

Updated

Questions

Yes. You paste the section on the canvas, and each setting is a custom attribute on the element that carries data-pixel-trail, for instance data-cell="12". Add Geist and Geist Mono to the site's fonts before pasting, because the Designer drops a font the site does not have.

No. The engine has no dependency and no build step. Every image is painted cell by cell into a single canvas laid over the section.

Put your <img> tags in a container marked data-pixel-trail-images inside the section. Any size and any aspect works: each picture is cropped to fill one card, the way object-fit: cover would, and the card is sized with data-width and data-height. A source smaller than twice the card in each direction is upscaled and reads soft.

Raise data-hold, the time in seconds a card stays whole before it breaks up. The default is 0.6. Under 0.4 only debris shows and the picture is never quite there, while a higher value lets the images linger and stack up along the path.

Yes, a finger traces it with no change, because the trail listens to pointermove. A trail on mobile is expensive though, so lower pool (16 cards by default) and the card width and height, or turn it on only for a fine pointer with matchMedia('(pointer: fine)').