sampleAt method
Sample the surface height (in amplitude units) at normalized x in
[0, 1] with the given phase in radians. This is the crest offset only;
vertical placement is carried separately by baseline.
Implementation
@override
double sampleAt(double x, double phase) {
final drift = phase / _twoPi;
var product = 1.0;
for (var i = 0; i < blobCount; i++) {
final center = (((i + 0.5) / blobCount) + drift) % 1.0;
final raw = (x - center).abs();
final distance = math.min(raw, 1 - raw); // wrap around the edges
final bump = math.exp(-math.pow(distance / radius, 2).toDouble());
product *= 1 - bump;
}
return -amplitude * (1 - product);
}