SketchBook

夜空

var s = s % 800;
var cloud1 = 5;
var cloud2 = 300;
var cloudb;

function setup() {
createCanvas(700, 700);
}

function draw() {
cloudb = 50;
frameRate(1);
background(0);
noStroke();
fill(255, 255, 0);
ellipse(600, 100, 80);
strokeWeight(2);
s = 0;
for (var i = 0; i < 140; i = i + 1) {
stroke(255);
line(s, 700, random(s - 1, s + 5), random(545, 555));
s = s + 5;
fill(255, 255, 0);
ellipse(s, random(0, 540), random(0, 5));
}

noStroke();
fill(255, 255, 255);
ellipse(cloud1, 120, cloudb);
ellipse(cloud1 + 35, 120, cloudb);
ellipse(cloud1 + 60, 120, cloudb);
ellipse(cloud1 + 20, 140, cloudb);
ellipse(cloud1 + 50, 140, cloudb);
ellipse(cloud1 + 80, 140, cloudb);
cloud1 = cloud1 + 10;

if (cloud1 > 700) {
cloud1 = -105;
}

ellipse(cloud2, 160, cloudb);
ellipse(cloud2 + 35, 160, cloudb);
ellipse(cloud2 + 60, 160, cloudb);
ellipse(cloud2 + 20, 180, cloudb);
ellipse(cloud2 + 50, 180, cloudb);
ellipse(cloud2 + 80, 180, cloudb);
cloud2 = cloud2 + 13;

if (cloud2 > 700) {
cloud2 = -105;
}
}