Skip to the content

Dot repel

A screen of fine dots lies behind the hero, pale, like the halftone of a printed page, and the cursor parts it: the dots near the pointer are pushed out of a round hole, the nearest the farthest, so they pile up on its rim, which takes a little ink.

Create a free account to unlock it.

Sign up free

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-dot-repel Marks the section the field lies behind. It takes no value: leave the value field empty. That section is what the canvas is laid under, what catches the pointer and what carries the settings, so it needs a height of its own. Without it on any section of the page, the embed marks the section it was pasted into.
    data-dot-repel-state Written by the engine on the section: live while dots move, idle at rest, still under reduced motion, held for a frozen field. Never written by hand. [ 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-dot-repel-color #15100c Colour of the dots. Options: any CSS colour; taken out of this block, --dot-repel-color on the section takes over, then the ink #15100c.
    data-dot-repel-rest 0.12 Opacity of a dot at rest, 0 to 1.
    data-dot-repel-peak 0.34 Opacity of a dot pushed the farthest, the ones piled on the rim of the hole, 0 to 1; never under rest.
    data-dot-repel-spacing 16 Distance between two dots of the grid, in px.
    data-dot-repel-dot 1.2 Radius of a dot at rest, in px; kept under half the spacing.
    data-dot-repel-reach clamp(120px, 12vw, 180px) Radius of the area the pointer parts, any CSS unit.
    data-dot-repel-grow 1.35 Radius of a dot pushed the farthest, in times dot.
    data-dot-repel-push 0.28 How far the nearest dots are pushed, in times reach, 0 to 0.5.
    data-dot-repel-life 0.9 Time a dot takes to spring back once the pointer moves on, in seconds.

What it does

Dot repel is a cursor animation for Webflow and vanilla JavaScript, with no library. Also called halftone dot grid cursor effect, interactive dot grid background or mouse repel dots.

A screen of fine dots lies behind the hero, pale, like the halftone of a printed page, and the cursor parts it: the dots near the pointer are pushed out of a round hole, the nearest the farthest, so they pile up on its rim, which takes a little ink. When the pointer moves on, the dots spring back to their place with a slight overshoot and the screen closes again. Nothing but dots, no picture to load: one canvas under the section's content, clicks pass through, only the dots around the pointer are worked on, and the loop sleeps as soon as the field has settled, even with the pointer resting on it. A finger drag parts it too and a tap leaves a small ripple running out through the dots; under reduced motion the screen stays still and answers nothing.

Updated

Questions

Paste the component, or put data-dot-repel with an empty value on a section of your own. If no section carries it, the embed marks the section it was pasted into. Settings are custom attributes on that section, for instance data-dot-repel-spacing="12", and the section needs content or a height, since at 0px tall it shows no dot.

No. The engine has no dependency and no build step, and there is no image to load. It draws the dots on one canvas that the script adds under the section's content.

Set data-dot-repel-reach, the radius the pointer parts, in any CSS unit, for instance data-dot-repel-reach="200px". The default is clamp(120px, 12vw, 180px). Lower and only the dots right under the pointer move, higher and the whole middle of the hero shifts.

No. The canvas sits under every word and link of the section with pointer-events: none, so it never takes a click. A child with a background of its own, a card or an image, hides the dots where it stands.

Yes. A finger drag parts the dots once it has travelled 10px, and the page still scrolls under it, while a short tap leaves a ripple running out through the dots. Under prefers-reduced-motion the dots stay, still, and answer neither the pointer nor a tap.