Each distorted blob starts out as a
circle
,
tightly fit
inside its parent
svg
element (which has its
viewBox
set such that its
0,0
point
is dead in the middle
). This circle then gets a
radialGradient
fill. Choosing the SVG radial gradient over the CSS one because it
also allows
setting focal point coordinates (
fx,fy
) distinct from
cx,cy
- hover any blob to see how its focal point follows the cursor.
<radialGradient id='g' gradientUnits='objectBoundingBox' fx='.35' fy='.65'><stop stop-color='var(--c0)'/><stop stop-color='var(--c1)' offset='.5'/><stop stop-color='rgba(from var(--c1) r g b/ 0)' offset='1'/></radialGradient>
The
circle
with the gradient is then blurred, distorted and given a grainy/ dithered look. The last two actions make use of the same concept of altering the input using noise generated by
feTurbulence
as a
displacement map
. The displacement used for distortion is relative to input size. The noise used for dithering is finer (larger
baseFrequency
value).
<filter id='distort' primitiveUnits='objectBoundingBox' x='-50%' y='-50%' width='200%' height='200%'><feTurbulence type='fractalNoise' baseFrequency='.00713'/><feDisplacementMap in='SourceGraphic' scale='.3' yChannelSelector='R'/></radialGradient><filter id='grain' x='-50%' y='-50%' width='200%' height='200%'><feTurbulence type='fractalNoise' baseFrequency='7.13'/><feDisplacementMap in='SourceGraphic' scale='32' yChannelSelector='R'/></radialGradient>