xxxxxxxxxx
42
var stars = [];
//let color;
function setup() {
createCanvas(600, 600);
//color = color('rgba(255,255,255,0.29)');
for (var i = 0; i < 5; i++) {
stars[i] = new Star();
}
}
function draw() {
frameRate(5);
background(30);
for (var i = 0; i < stars.length; i++) {
stars[i].draw();
}
}
// star class //
class Star {
constructor() {
this.x = random(width);
this.y = random(height);
this.size = 15;
this.t = random(TAU);
}
draw() {
this.t += 0.1;
var scale = this.size + sin(this.t) * 6;
noStroke();
fill(color('rgba(255,255,255,0.5)'));
ellipse(this.x, this.y, scale, scale);
}
}