class Cloud{ constructor(x, y, w, h){ this.x = x; this.y = y; this.width = w; this.height = h; this.v = 0.25; this.brightness = random(0.75, 1); } move(){ this.x += this.v; if (this.x - this.width / 2 > worldWidth){ this.x = -this.width; } } show(){ fill(255 * this.brightness); if (this.x + this.width * 9 / 8 > viewPort.x && this.x - this.width * 9 / 8 < viewPort.x + width){ ellipse(this.x + this.width / 4, this.y + this.height * 2 / 3, this.width / 2, this.height / 2); ellipse(this.x + this.width / 2, this.y + this.height * 2 / 3, this.width / 2, this.height / 2); ellipse(this.x + this.width * 3 / 4, this.y + this.height * 2 / 3, this.width / 2, this.height / 2); ellipse(this.x + this.width * 3 / 8, this.y + this.height * 1 / 3, this.width / 2, this.height / 2); ellipse(this.x + this.width * 5 / 8, this.y + this.height * 1 / 3, this.width / 2, this.height / 2); } } }