1 lines, no comments ยท 628 tokens, written in 10 seconds for $0.010


1  let bubbles = []; const NUM_BUBBLES = 30; function setup() { createCanvas(windowWidth, windowHeight); for (let i = 0; i < NUM_BUBBLES; i++) { bubbles.push(new Bubble()); } } function draw() { background(10, 10, 30, 25); for (let b of bubbles) { b.update(); b.draw(); } } class Bubble { constructor() { this.reset(); } reset() { this.r = random(20, 70); this.x = random(this.r, width - this.r); this.y = random(this.r, height - this.r); this.vx = random(-3, 3); this.vy = random(-3, 3); this.hue = random(360); this.alpha = random(100, 200); this.speed = random(1, 3); } update() { this.x += this.vx; this.y += this.vy; if (this.x - this.r < 0) { this.x = this.r; this.vx *= -1; } if (this.x + this.r > width) { this.x = width - this.r; this.vx *= -1; } if (this.y - this.r < 0) { this.y = this.r; this.vy *= -1; } if (this.y + this.r > height) { this.y = height - this.r; this.vy *= -1; } this.hue = (this.hue + 0.5) % 360; } draw() { colorMode(HSB, 360, 100, 100, 255); let c = color(this.hue, 80, 100, this.alpha * 0.5); let edge = color(this.hue, 60, 100, this.alpha); fill(c); stroke(edge); strokeWeight(2); ellipse(this.x, this.y, this.r * 2); let glowSize = this.r * 0.4; fill(360, 0, 100, this.alpha * 0.8); noStroke(); ellipse(this.x - this.r * 0.3, this.y - this.r * 0.3, glowSize, glowSize * 0.6); colorMode(RGB, 255); } } function windowResized() { resizeCanvas(windowWidth, windowHeight); }