floorLight function
A pool of light on the floor: an ellipse of glow, k at its middle falling to 0 at its rim.
Implementation
void floorLight(
Painter p,
double x,
double y,
double rx,
double ry,
int c,
double k,
) {
if (k <= 0.004 || rx < 1.0 || ry < 0.5) return;
p.shade(x - rx, y - ry, x + rx, y + ry, (px, py, out) {
final dx = (px - x) / rx;
final dy = (py - y) / ry;
final d = dx * dx + dy * dy;
if (d >= 1.0) return null;
final f = 1.0 - math.sqrt(d);
out.l = c;
out.k = f * f * k;
return null;
});
}