Skip to the content

Infinite grid

A wall of tiles that never ends, seen through a bulged lens, as if it were the inside of a sphere: the tiles in the middle are flat and large, those near the edges narrow and lean away into a shadow, and no edge of the wall is ever visible, in any direction, at any size of the box.

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

    Give the wall a height: once mounted the tiles are placed by the script and no longer push the box open. The size of a tile is not a class here but the width and height settings, which the script hands to the stylesheet. And leave the transform of a tile to the engine, which writes it every frame.
  3. Add custom JS

  4. Use it on your own elements

    Custom attributes
    Select the element 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-infinite-grid Marks the box that holds the tiles. It takes no value: leave the value field empty. That box is the wall: what the hand drags, what the lens is measured on, what the effect is mounted on and what carries the settings. It takes its height from the page. Without it on any box of the page, the embed marks the parent of every tile it finds (data-infinite-grid-tile).
    data-infinite-grid-tile Marks one tile, a direct child of the wall. It takes no value. A tile can be a link: a plain click still opens it, a drag never does. Without it on any tile, the wall takes its own children as the tiles. [ Optional ]
    data-infinite-grid-state Written by the engine on the wall once mounted: ready. Never written by hand; the stylesheet reads it to clip the wall, keep the gesture, take the tiles out of the flow and lay the shadow of the lens. [ Optional ]
    data-infinite-grid-dragging Written by the engine on the wall while a drag runs. Never written by hand; the stylesheet reads it for the closed hand. [ Optional ]
    data-infinite-grid-clone Written by the engine on the copies of the tiles it adds to fill the wall, each one hidden from screen readers and out of the Tab order. Never written by hand. [ Optional ]
    Settings
    Every setting is a custom attribute too, added the same way and on the same element. An attribute always wins over the defaults written in the code.
    AttributeDefaultWhat it is
    data-infinite-grid-tint #0e0b09 Colour the wall falls into towards its corners, the ground of the page in the preview. Options: any CSS colour, best the colour behind the wall; taken out of this block, --infinite-grid-tint on the wall takes over.
    data-infinite-grid-shade 0.6 Strength of that shadow in the corners of the box, 0 to 1.
    data-infinite-grid-bulge 0.42 Curve of the lens, 0 to 0.8: how much the tiles shrink and lean away towards the edges.
    data-infinite-grid-swell 0.14 Bulge added while the wall runs fast, 0 to 0.3, gone again as it slows.
    data-infinite-grid-width clamp(170px, 21vw, 420px) Width of a tile, any CSS unit, as drawn in the middle of the box.
    data-infinite-grid-height clamp(124px, 15.3vw, 306px) Height of a tile, any CSS unit, as drawn in the middle of the box.
    data-infinite-grid-gap clamp(12px, 1.7vw, 32px) Space between two tiles, on both axes, any CSS unit.
    data-infinite-grid-stagger 0.5 How far every other column sits lower, as a share of one cell, 0 to 1.
    data-infinite-grid-friction 0.05 Share of its speed a thrown wall loses on each frame, 0 to 1.
    data-infinite-grid-drift 22 Speed of the wall when nobody touches it, in pixels per second.
    data-infinite-grid-angle 24 Direction of that drift, in degrees: at 0 the tiles run to the left, at 90 upwards. Options: any angle; 180 runs to the right, 270 downwards.
    data-infinite-grid-wheel 1 Whether the wheel and the trackpad move the wall, 0 or 1.
    data-infinite-grid-lift 1.04 Scale of the tile right under the pointer.

What it does

Infinite grid is a cursor animation for Webflow and vanilla JavaScript, with no library. Also called spherical infinite gallery, fisheye infinite grid or curved infinite gallery.

A wall of tiles that never ends, seen through a bulged lens, as if it were the inside of a sphere: the tiles in the middle are flat and large, those near the edges narrow and lean away into a shadow, and no edge of the wall is ever visible, in any direction, at any size of the box. The wall drifts slowly on its own. The hand grabs it anywhere, with the mouse, a pen or a finger, drags it and throws it; it runs on with the speed it was given, the lens swelling a little while it runs fast, then settles back into its drift. The wheel and the trackpad move it too. The tiles are the page's own elements, pictures or cards with a title, repeated as the wall needs and coming round again on both axes; each one stays a real element, so a click on a tile, never a drag, opens its link or fires an event. The arrow keys move the wall by one tile and Tab brings each tile to the middle. No library and no WebGL: one projective matrix per tile and per frame, on a few dozen nodes. Under reduced motion the wall keeps its bulge and follows the hand, and nothing drifts, swells or runs on. Pattern type infinite grid, spherical gallery, fisheye wall.

Updated

Questions

Put the custom attribute data-infinite-grid on a box and data-infinite-grid-tile on each of its direct children, pictures or cards; twelve tiles is a good number. Give the box a height of its own, a full screen or a fixed band, because the script places the tiles and they no longer push it open. Settings go on the box, for instance data-infinite-grid-bulge="0.6".

No, it loads no library and draws no canvas. Each tile is a real element stretched onto four points of the lens by one matrix3d per frame, on a few dozen nodes: about fifty at 1440 by 900 with the defaults, however far the wall is thrown.

Yes. A press that travels less than six pixels opens the tile's link, on a wall that drifts too, and a drag never opens one. For tiles that are not links, listen on the wall for infinitegrid:click, which names the tile of the markup whether the click landed on it or on one of its copies.

data-infinite-grid-bulge is the curve of the lens, 0.42 by default: at 0 the wall is a plain endless grid, past 0.6 it is a strong fisheye with more nodes on the page. data-infinite-grid-drift is the idle speed in pixels per second, 22 by default, and 0 keeps the wall still at rest. data-infinite-grid-swell is the bulge added while a throw runs fast.

The wall keeps the wheel and the trackpad while the pointer is on it. Set data-infinite-grid-wheel="0" on a wall that sits in the middle of a long page and the wheel scrolls the page as usual. A finger always drags the wall on both axes, so on a phone keep it shorter than the screen, or make it the whole page.