Backgrounds

Marbling

Paper marbling made with the exact drop and comb math from the paper Mathematical Marbling. Each new ink drop pushes every older ring outward. The rings stretch, but they never overlap or tear. Every few drops, a comb drags through the ink and pulls it into feathers. Drag across it to pull the ink like a stylus.

Install

# Marbling needs no npm packages

Then copy 2 files into your project:

  • components/registry/marbling/marbling.tsx
  • hooks/use-animation-loop.ts

Props

PropTypeDefaultDescription
dropIntervalnumber0.9Time between ink drops.
dropSizenumber48The radius of a fresh drop.
combStrengthnumber1How far each comb pass drags the ink. 0 stops the combing.
tineSpacingnumber80The gap between the teeth of the comb.
sharpnessnumber22How fast a tooth's pull fades with distance. Small values make thin, sharp feathers.
stylusbooleantrueLet a drag pull the ink. Turn it off to keep touch scrolling on phones.
inkColor1string (hex)"#a855f7"The first ink.
inkColor2string (hex)"#3b0764"The second ink.
inkColor3string (hex)"#d4a24c"The third ink.
paperColorstring (hex)"#f3ecdf"The paper under the ink. Once the ink covers it all, only the inks show.

What It Demonstrates

Loop
An animation that repeats, a set number of times or infinitely.
Idle animation
Subtle motion that plays while an element is just sitting there, waiting to be interacted with.
Drag
Moving an element by grabbing it, often with momentum when released.

Related Components

Appears In