Skip to content
Backgrounds Fancy Stable

MosaicGlow

.md

Canvas mosaic of small tiles on a dark surface where a soft halo follows the cursor with a lag, lighting tiles to random gold intensities that decay into a comet trail, with an additive bloom over the gaps, a glassy per-tile highlight, ambient flicker and an autonomous drift when idle

Available for Svelte 5, React, and Vue 3.

Preview

Installation

pnpm add fancy-ui-svelte
import { MosaicGlow } from "fancy-ui-svelte";

Usage

svelte
<script lang="ts">
	import { MosaicGlow } from "fancy-ui-svelte";
</script>

<MosaicGlow class="h-80 w-full rounded-2xl border border-white/10">
	<div class="flex h-full flex-col items-center justify-center gap-2 text-center">
		<h3 class="text-2xl font-semibold tracking-tight text-white">Something is glowing</h3>
		<p class="text-sm text-white/60">Move your cursor across the tiles</p>
	</div>
</MosaicGlow>

Examples

Basic Usage

Colors

Any hex or rgb() colour for the halo and the surface.

Dense Grid

Smaller tiles for a finer mosaic.

Trail and Idle

A short, cursor-only trail versus a long comet that keeps drifting.

Interactive Playground

Props

PropTypeDefaultDescription
hdr booleantrueOn a display that reports HDR, adds the light above SDR white in a WebGPU layer with extended tone mapping: the hottest tiles peak around 1000 nits and the halo gets a hot core. Elsewhere nothing starts and the mosaic is unchanged
tileSize number18Tile edge in CSS px
gap number2Gap between tiles in CSS px
color string"#f2c318"Halo and tile colour, hex or rgb()
background string"#0a0a0a"Surface colour behind the tiles, hex or rgb()
radius number170Halo radius in CSS px
intensity number1Overall brightness of lit tiles, 0 to 1
trail number0.6How long lit tiles linger after the halo moves on, 0 to 1
smoothing number0.15Pointer lag, 0 (instant) to 1 (very laggy)
noise number0.7Spread of per-tile random brightness inside the halo, 0 to 1
ambient number0.35Visibility of the random faint tiles outside the halo, 0 to 1
flicker booleantrueSlowly re-roll the faint tiles over time
idle "drift" | "none""drift"With no pointer for 1.5s: drift wanders the halo on a slow path, none switches it off
interactive booleantrueFollow the pointer. Off leaves only the idle behaviour
seed number1Seed for the per-tile randomness; same seed, same mosaic
ref HTMLDivElement | nullnullBindable host element
class string-Additional classes on the host

Slots

SlotDescription
children Content rendered above the canvas; give the host a height