DevTools Logo

SVG Displacement Filter Lab

SVG Displacement Filter Lab

Design deterministic SVG turbulence and displacement filter chains locally

Filter parameters

Chain: turbulence → displacement → blur → colorMatrix. Seeded turbulence keeps this output deterministic.

About

Design seeded SVG filters with glass, water wave, glitch, and paper texture presets, then copy the generated SVG defs.

Examples

Water preset filter

Input
generateSvgFilter(getSvgFilterPreset("water"))
Output
"<filter id=\"displacement-filter\" ...><feTurbulence .../></filter>"

Emits feTurbulence, feDisplacementMap, feColorMatrix, and feGaussianBlur in the water chain order.

Seed determinism

Input
generateSvgFilter({ ...getSvgFilterPreset("glass"), seed: 5 })
Output
"... seed=\"5\" ..." (identical on every run)

Same options always produce byte-identical XML; changing the seed changes the noise field.

About this tool

SVG Displacement Filter Lab builds gooey distortion filters with generateSvgFilter(options): feTurbulence (fractalNoise or turbulence with baseFrequency, numOctaves, seed) feeds feDisplacementMap (scale plus xChannelSelector/yChannelSelector), then optional feGaussianBlur and feColorMatrix saturate/hueRotate stages run in the order given by chain.

Presets come from getSvgFilterPreset (glass, water, glitch, paper) via SVG_FILTER_PRESETS — each preset pins baseFrequency, scale, channel selectors, and chain order, and validateSvgFilterOptions rejects non-positive baseFrequency values, numOctaves outside 1–16, empty or duplicated chain steps, and invalid filterId XML identifiers.

Output is deterministic and client-side: the same options (including seed) always emit byte-identical <filter> XML with named intermediate results (noise, displaced, blurred, saturated, colored).

How to use this tool

  1. Pick a preset

    Call getSvgFilterPreset with glass, water, glitch, or paper, then tweak scale, seed, or blur on the returned copy.

  2. Set turbulence

    Choose baseFrequency (number or [x, y] pair), numOctaves from 1 to 16, and a seed — identical seeds give identical noise.

  3. Order the chain

    List each of turbulence, displacement, blur, and colorMatrix at most once in chain; primitives emit in that order.

  4. Paste the filter

    Copy the returned <filter> XML (default id displacement-filter, or your own filterId) into an SVG defs block.

Use cases

Designing frosted-glass cards

Use the glass preset's low scale and slight blur for readable backdrop distortion.

Prototyping liquid hover effects

Raise scale on the water preset to preview gooey image warps before hand-tuning.

Adding glitch accents

Apply the high-scale glitch preset to headings for RGB-split style distortion.

Common mistakes

Mistake:Passing zero or negative baseFrequency.

Fix:Every frequency component must be finite and greater than zero — values like 0 or [0.2, -1] throw.

Mistake:Repeating a step in chain.

Fix:Each of turbulence, displacement, blur, and colorMatrix may appear at most once; duplicates throw.

Mistake:Using an invalid filterId with spaces.

Fix:filterId must match XML identifier rules (letters, digits, _, -, ., :); the default displacement-filter is used when blank.

Frequently asked questions

What does this tool do?

It builds SVG distortion filters with generateSvgFilter — feTurbulence plus feDisplacementMap with optional blur and colorMatrix stages — and ships glass, water, glitch, and paper presets via getSvgFilterPreset.

How do seed and baseFrequency change the output?

baseFrequency sets the noise grain (a number or [x, y] pair, all components finite and positive); identical seeds emit byte-identical XML while a new seed reshapes the noise field.

Is my artwork uploaded or stored?

No. Preset math, validation, and XML generation run entirely in your browser.

Why did my options throw?

Non-positive baseFrequency, numOctaves outside 1–16, empty or duplicated chain steps, and invalid filterId values throw — check the baseFrequency message first.

References & standards

.env Secret Safety Linter

Validate .env syntax and spot likely leaked credentials or placeholder secrets.

.htaccess Generator

Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth

2D Fluid Dynamics & Particle Physics Sandbox

A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.

AI Function Calling Schema Generator

Generate function calling JSON schemas from TypeScript interfaces

Algorithm Arena & Data Structure Visualizer

Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML