🔬 These are the first two color stops of the iridescent gradient. What happens if you swap the 95%, 85% saturation/lightness values for something like 40%, 20%, making the sheen look darker and more metallic?
grad.addColorStop(0.0, `rgba(255,255,255,${0.9 * alphaScale})`); // bright core
grad.addColorStop(0.25, `hsla(${hue}, 95%, 85%, ${0.75 * alphaScale})`); // soft highlight
display() {
const ctx = drawingContext; // 2D CanvasRenderingContext2D
const r = this.radius;
const time = millis() / 1000;
const fade = this.getFadeFactor();
if (fade <= 0) return;
const alphaScale = this.baseAlpha * fade;
// Wobble: time-based horizontal oscillation
const wobbleX = sin(TWO_PI * this.wobbleFreq * time + this.phase) * this.wobbleAmp;
const x = this.x + wobbleX;
const y = this.y;
// Sheen highlight: small bright spot that orbits around the bubble
const angle = this.sheenSpeed * time + this.phase;
const sheenOffset = r * 0.4;
const gx = x + cos(angle) * sheenOffset;
const gy = y + sin(angle) * sheenOffset;
// Iridescent radial gradient
const grad = ctx.createRadialGradient(gx, gy, r * 0.15, x, y, r);
// Animate the rainbow hue slightly over time
const hue = (this.baseHue + time * 40) % 360;
grad.addColorStop(0.0, `rgba(255,255,255,${0.9 * alphaScale})`); // bright core
grad.addColorStop(0.25, `hsla(${hue}, 95%, 85%, ${0.75 * alphaScale})`); // soft highlight
grad.addColorStop(0.5, `hsla(${(hue + 60) % 360}, 90%, 70%, ${0.45 * alphaScale})`); // warm tint
grad.addColorStop(0.8, `hsla(${(hue + 140) % 360}, 90%, 65%, ${0.20 * alphaScale})`); // cool rim
grad.addColorStop(1.0, `rgba(255,255,255,0)`); // fade to transparent
// Use the gradient as fill for the bubble
ctx.fillStyle = grad;
noStroke();
ellipse(x, y, r * 2, r * 2);
// Subtle outer rim to make the bubble edge visible
stroke(255, 255, 255, 160 * alphaScale);
strokeWeight(r * 0.06);
noFill();
ellipse(x, y, r * 2.02, r * 2.02);
// Small inner highlight arc for extra realism
push();
translate(x, y);
rotate(-PI / 3);
stroke(255, 255, 255, 200 * alphaScale);
strokeWeight(r * 0.07);
noFill();
arc(0, 0, r * 1.1, r * 1.1, -PI * 0.15, PI * 0.35);
pop();
}