Advanced
More complex behavior: canvas, SVG and anything heavier than the everyday attachments and components.
[ Bg Dust - Attachment ]
A moving, grainy light field behind an element, drawn on the GPU. Soft glows drift, form and dissolve, a fine sparkle flows through them, and the pointer pushes them along and lights the field under it. It follows the site's light and dark theme, and it can also change theme as the page scrolls. It only runs while the element is on screen, and with reduced motion it draws one still frame. A site uses one instance: on a section, or on <body> with fixed, where sections should have no background of their own. Every option is optional, and the groups (lobes, ripple, turbulence, mouse, crease, vignette) take only the values you set.
Available options:
fixedA boolean. Covers the whole screen and follows it, instead of covering the element. Meant for<body>. Defaults tofalse.colors{ dark, light }, each{ base, highlight }: the field and the glow that drifts across it, as any CSS color. Defaults to navy for dark and white with a blue glow for light.themefollow | dark | light.followmatches the site's theme (thedata-themeon<html>), or pin it to one. Defaults tofollow.sectionsA boolean. Withfollow, changes theme as the page scrolls, to match each element withdata-bg-theme="light"or"dark".data-bg-theme-start(0-1, default0.5) sets how far up the screen the element must be. Defaults tofalse.motionSpeedA number, the pace of everything that moves.0freezes it. Defaults to3.5.fadeInA number, seconds the glow takes to fade in on load. Defaults to3.lobes{ count, drift, radius, radiusVariance, formMin }. How many glows (1-4, default3), how far each wanders (0.46), their average size (0.3), how much that varies (0.14), and the lowest brightness one dips to (0.12, and0lets it vanish).ripple{ enabled, centerX, centerY, spacing, shift, cycles }. Stationary rings, centered above the top edge, that cut the glow into bands. Defaults aretrue,0,1.4,0.18,0.85and1.turbulence{ speed, scale, intensity, curl, curlScale }. The fine sparkle: how fast it drifts (0.0075), how fine it is (520, higher is finer), how bright (0.08), and how much it wobbles (0.5, scale3.5).mouse{ radius, glowRadius, push, glowBoost, positionSmoothing, influenceSmoothing, velocityReference, velocityAttack, velocityRelease, sparkle, sparkleRadius, sparklePush, sparkleTrail, sparkleTrailLength, sparkleEdgeNoise, sparkleSwap, sparkleDirectionSmoothing }. How the pointer pushes the glows and lights the field.sparkle: truelets it push the sparkle as well, with a trail. The defaults are the tuned ones, so start frompush,glowBoostandsparkle.crease{ angle, offset, width, strength }. A soft diagonal shadow. Defaults are-20,0.08,0.24and0.12.vignette{ start, end, strength }. Darkens the edges. Defaults are0.15,0.95and0.55.grainA number, the film grain from0up. Defaults to0.035.
Defaults
Follows the site theme: switch the theme in the footer to see both palettes.
Content sits in front
Move the mouse over this frame. The effect is drawn behind everything in the section.
Accent colors, with sparkle
Custom colors in the accent, no ripple, and mouse.sparkle so the pointer pushes the fine grain too.
Content sits in front
Move the mouse over this frame. The effect is drawn behind everything in the section.
[ Bg Grid - Attachment ]
Draws a grid of lines behind an element. Squares near the pointer light up and fade away, and every so often the grid lights up by itself so a visitor without a mouse still sees it. It is a transparent canvas behind the element's content, so the element's own background shows through, and it only runs while something is animating and the element is on screen. It does nothing when motion is reduced. Put it on a section to give just that section a grid, or on <body> with fixed for the whole site, where sections should have no background of their own.
Available options:
cellSizeA number, the width and height of each square in px. Defaults to48.colorA string, any CSS color for the lines, includingvar(--color-border). Defaults tovar(--color-border).lineWidthA number, the line width in px. Defaults to1.fadeA number, seconds a square takes to fade away. Defaults to0.85.spreadA number from 0 to 1, the chance that each square touching the one under the pointer lights up too. Defaults to0.5.ambientA number, milliseconds between the grid lighting up by itself.0turns it off. Defaults to7500.fixedA boolean. Covers the whole screen and follows it, instead of covering the element. Meant for<body>. Defaults tofalse.showA boolean, or{ enter, exit, stagger }. Holds the whole grid on while the element is mostly on screen, then fades it out.enterandexitare how it sweeps:stack-top,stack-bottom,stack-left,stack-right,ripple-out,ripple-in,random,diag-tl,diag-tr,diag-brordiag-bl(defaultstack-top), andstaggeris milliseconds between squares (default50).disableOnA selector for elements inside that stop the pointer from lighting squares while it is over them, such as buttons.hideOnA selector for elements inside that hide the grid completely while the pointer is over them.
Follows the pointer
The defaults, with disableOn: '.demo-button' so the button's own area stays dark.
Content sits in front
Move the mouse over this frame. The effect is drawn behind everything in the section.
Shown while in view
show with ripple-out in and out, cellSize: 32. The whole grid ripples in from the center when the second section scrolls into view and out again as it leaves. The grid covers the whole mock site, and trigger: '.demo-trigger' picks the section that turns it on.
Scroll down
The effect is on here
It turns on while this section is in view and off again when it leaves.
No effect here
[ Bg Waves - Attachment ]
A field of particles that ripples like water, seen from above and behind, drawn on the GPU. With follow, particles near the pointer light up to full strength. The color follows the site's theme when it is a CSS variable. It only runs while the element is on screen, and with reduced motion it draws one still frame. Sizes are in the field's own units, not px: width and depth set how far it spreads and gap how tightly it is filled, so a smaller gap draws many more particles.
Available options:
fixedA boolean. Covers the whole screen and follows it, instead of covering the element. Meant for<body>. Defaults tofalse.widthA number, how far the field spreads from side to side, in the field's own units. Defaults to40.depthA number, how far it spreads front to back, in the same units. Defaults to25.gapA number, the space between particles in the same units. Smaller draws more of them. Defaults to0.5.colorA string, any CSS color, includingvar(--color-accent). Defaults tovar(--color-text).opacityA number from 0 to 1, how solid the particles are. Below1,followcan light them up. Defaults to1.speedA number, how fast the waves move. Defaults to0.01.followA number, how far from the pointer particles light up to full strength, in the field's own units.0turns it off, and it needs anopacitybelow1to show. Defaults to0.fadeTopA number, how much of the top edge fades out, as a percent of the height.0leaves it hard. Defaults to0.camera{ height, distance, fov }, where the camera looks down from and how wide it sees. Defaults are6,5and75.
Defaults
The theme's text color, with a faded top edge.
Content sits in front
Move the mouse over this frame. The effect is drawn behind everything in the section.
Follows the pointer
Accent color, opacity: 0.5 and follow: 25, so particles near the pointer light up. A smaller gap makes it denser.
Content sits in front
Move the mouse over this frame. The effect is drawn behind everything in the section.
[ Cursor Fluid - Attachment ]
A faint, liquid ribbon that follows the mouse. The pointer stirs a small fluid simulation on the GPU and leaves a thin trail that bends along and fades quickly. By default the light splits into colored fringes, like glass; mode: 'ink' makes it a soft tint of one color instead. It sits behind the element's content, so it shows on the open background around text and images. In ink mode it follows the site's theme for its color. It only runs while the pointer is moving over an element on screen. It does nothing when motion is reduced or without a mouse. Put it on a section, or on <body> with fixed for the whole site, where sections should have no background of their own.
Available options:
fixedA boolean. Covers the whole screen and follows it, instead of covering the element. Meant for<body>. Defaults tofalse.colorAny CSS color for the fluid, includingvar(--color-accent). Defaults to the accent color.opacityA number from 0 to 1, how solid the fluid is where it is thickest. Defaults to0.5.sizeA number, the size of the splash under the pointer as a fraction of the screen's shorter side. Defaults to0.03.forceA number, how hard the pointer pushes the fluid along. Defaults to2000.swirlA number, how strongly the fluid curls into eddies.0leaves it smooth. Defaults to4.fadeA number from 0 to 1, how much color is left after one second. Lower disappears sooner. Defaults to0.03.dragA number from 0 to 1, how much speed is left after one second. Lower stops sooner. Defaults to0.05.
Defaults
Move the mouse across the frame, and over the empty space around the text.
Content sits in front
Move the mouse over this frame. The effect is drawn behind everything in the section.
Ink
mode: 'ink' in the accent color, with a larger size, more swirl and a slower fade, so it billows like ink in water.
Content sits in front
Move the mouse over this frame. The effect is drawn behind everything in the section.
[ Dots Fill - Attachment ]
Goes on an <svg>, or on an <img>. On an <svg> it turns the fill of every shape inside into a grid of dots that the pointer pushes around: a dot is drawn wherever a grid point lands inside a shape, and the shapes are hidden until the attachment is removed. Use rect, circle, ellipse, path and polygon without a transform. An <img> keeps its shapes out of reach, so it is drawn to a canvas instead and every grid point on a solid pixel gets a dot. That works for an SVG file and for any picture with transparency, such as a PNG or WebP cut-out, as long as it comes from your own site or allows cross-origin reads. On an <img> the sizes are in px and the dots are redone when it resizes. The dots only move while it is on screen, and stay still when motion is reduced.
Available options:
sizeA number, the radius of each dot in the SVG's own units. Defaults to1.gapA number, the space between dot centers in the same units. Defaults to16.restoreA number from 0 to 1, how quickly the pointer's speed fades once it stops. Higher stops the push sooner. Defaults to0.04.sensitivityA number from 0 to 1, how long dots keep moving after a push. Closer to1springs back more slowly. Defaults to0.95.distanceA number, how far from the pointer dots react, in the SVG's own units. Defaults to50.strengthA number, how hard the pointer pushes dots away. Defaults to10.colorA string, any CSS color, includingvar(--color-accent). Defaults to the SVG's own text color.illuminateA boolean. Dots dim away from the pointer, so the ones near it light up. Defaults tofalse.growA number, how much dots swell near the pointer as a multiple of their size.0keeps them the same size. Defaults to0.
[ Grid Flow Img - Attachment ]
Goes on an <img>. The picture is cut into blocks that the mouse drags along as it moves, with a color split that follows the speed of the move and fades once it stops. A canvas is laid over the image and draws the same picture with a small WebGL shader, so no library is loaded. Size and shape come from your own CSS on the image, and the canvas takes its position and rounded corners. It does nothing without a mouse or with reduced motion, and the image is left as it is. The picture must be from your own site or allow cross-origin reads.
Available options:
easeA number from 0 to 1, how quickly the effect follows the pointer. Lower trails further behind. Defaults to0.05.rangeA number from 0 to 1, how far from the pointer the effect reaches, as a share of the image. Defaults to0.3.gridA number, how many blocks the image is cut into along each side. Fewer is chunkier. Defaults to32.intensityA number, how strong the color split is while the pointer moves. Defaults to1.fitcover | contain | stretch. How the picture sits in the image's box, likeobject-fit. Defaults tocover.greyscaleA boolean. Draws in black and white until the pointer is over it. Defaults totrue.

[ Image Lens - Attachment ]
A glass lens that follows the mouse over a picture, a port of the hero lens on stripesessions.com. The picture is read into a WebGL texture and a small shader bends it at the edge of a circle, enlarges the middle, splits the colors, blurs and adds a highlight. Because it is drawn from the picture's own pixels and not the page behind it, it works in every browser, Safari included, which backdrop-filter with an SVG filter does not. Put it on an <img>. It follows object-fit and object-position, appears while the mouse is over the picture, shrinks a little when pressed, and follows the picture's rounded corners. It needs a picture from this site, or one served with CORS headers. It does nothing without a mouse, and with reduced motion the lens follows without easing. Each picture uses one WebGL context.
Available options:
radiusA number, the radius of the lens in px. Defaults to60.refractionA number, how strongly the rim bends the picture. Defaults to1.bevelA number from 0 to 1, how much of the radius is the bent rim. Defaults to0.4.magnifyA number, how much the middle is enlarged. Defaults to0.12.dispersionA number, how far the colors split apart at the rim. Defaults to0.24.blurA number, the blur through the glass in px. Defaults to4.2.tintA number from 0 to 1, how much white is mixed in, strongest on the right. Defaults to0.45.highlightA number from 0 to 1, how bright the light on the top left of the rim is. Defaults to0.7.
Clear
Less blur and tint, so the picture shows through almost untouched. Move the mouse over it.

Large and bent
A bigger radius with stronger refraction and magnify, and only a little blur and tint, so the picture bends without clouding.

[ Text Flies - Attachment ]
Turns text into a swarm of tiny dots that drift inside the letters, a port of the Flies material from Blotter.js. The text is drawn on a canvas over the element and shown on the GPU, and the real text stays in place, invisible but selectable and readable by screen readers. It takes the element's color, font, size and line breaks. It only runs while the element is on screen, redraws when the size, fonts or theme change, and does nothing when motion is reduced. Each element uses one WebGL context, so keep it to a few headings per page.
Available options:
cellA number, the size of the cell each fly roams in, as a fraction of the font size. Smaller means more, finer dots. Defaults to0.025.radiusA number from 0 to 1, how big each dot is within its cell. Defaults to0.75.growA number, how far the dots may roam past the edges of the letters, in cells. Without it the words look narrower than the real text, since a dot needs its whole cell inside a letter.0keeps them inside. Defaults to0.5.speedA number, how fast the dots drift. Defaults to1.dodgeA boolean. Dots near the mouse scatter away from it, leaving a hole that follows the pointer. Defaults tofalse.dodgeSpreadA number, how far the scatter reaches, as a fraction of the element's height. Defaults to0.25.
Defaults
The flies
Dodge
dodge with finer dots (cell). Move the mouse over the text.