function generateRandomRipple({
cx,
cy,
t = 0.5,
strength = 0.5,
maxSize = 100,
seed = "1"
} = {}) {
if (cx === undefined || cy === undefined) {
throw Error("Required options missing: cx, cy");
}
const rippleRnd = CSRandom.createRandom(seed);
const rings = Math.round(math.lerp(3, 7, strength));
const maxRadius = math.lerp(maxSize / 3, maxSize, strength);
const minRadius = math.lerp(1, maxRadius, t);
const ringsData = math
.linspace(rings, true)
.map((uv, i, arr) => {
const rt = delayedT(t, i + 1, rings);
if (rt === 1) return;
const r = math.lerp(0, maxRadius, rt) || 0.5;
const circum = 2 * Math.PI * r;
const dashT = math.mapRange(r, minRadius, maxRadius, 0, 1, true);
const dash = math.lerp(circum / 40, circum / 10, dashT);
const gap = dash * 3;
const offset = rippleRnd.range(0, circum / 3);
const dasharray = r < minRadius ? [] : [dash, gap, dash];
return {
r,
dasharray,
offset
};
})
.filter(Boolean);
return { rings: ringsData, cx, cy };
}