xxxxxxxxxx
39
function setup() {
createCanvas(800, 600);
}
function draw() {
background(0); // set the background to black
noStroke();
// create twinkling stars
fill(255);
for (let i = 0; i < 50; i++) {
let x = random(width);
let y = random(height);
ellipse(x, y, 2, 2);
}
// create a full moon
fill(240, 240, 240);
ellipse(width / 2, height / 2, 200, 200);
// create a reflection on the water
fill(210, 210, 210, 100);
ellipse(width / 2, height / 2 + 80, 220, 30);
// create a ripple effect
let y = height / 2 + 80;
let r = 0;
for (let i = 0; i < 5; i++) {
ellipse(width / 2, y, r, 10);
r += 20;
y += 10;
}
// create a slow zoom in and out effect
let scaleAmount = map(sin(frameCount / 100), -1, 1, 0.9, 1.1);
translate(width / 2, height / 2);
scale(scaleAmount);
translate(-width / 2, -height / 2);
}