render/glass/mesh_painter library

The mesh-gradient background (BackgroundKind.meshGradient; Liquid Glass's "vivid animated background", spec §5.3 #2): the base colour plus a soft radial blob per further colour, laid out by the spec's angle and drifting on its period (motion brief §4.13, ≥ 40 s).

Cheap: each blob is one cached unit radial shader (colour → transparent) drawn as a rect moved and scaled with the canvas, so a drift frame is one rect fill plus one rect per blob and allocates no shader. Blobs blend in encoded sRGB, so every painted colour lies in the colour hull the guardrails sample (meshHullSamples).

Constants

meshAnchors → const List<(double, double, double)>
Blob anchors in the unit square (before the spec's rotation) and radii as a fraction of the longest side.

Functions

meshBlobs(BackgroundSpec spec, Size size, double seconds) → List<MeshBlob>
The blob geometry of spec on size at drift time seconds.
meshBlobShader(Color color) → Shader
The unit radial shader of one blob colour (colour → transparent).
paintMesh(Canvas canvas, Size size, BackgroundSpec spec, double seconds, {required Shader shaderFor(int argb)}) → void
Paints spec's mesh on canvas at drift time seconds; shaderFor returns the (cached) unit shader of a blob colour.

Typedefs

MeshBlob = ({Offset center, double radius})
One blob: centre and radius in logical pixels.