xxxxxxxxxx
int tick;
ArrayList < celestial > planets = new ArrayList < celestial > ();
celestial Star;
void setup() {
size(1000, 1000);
fullScreen();
Star = new celestial(width / 2, height / 2, 50, 4, 0.2, color(245, 255, 43));
for (int i; i < 101; i++;) {
planets.add(0, new celestial(width / 2, height / 2, random(2, 10), (i * 10 + random(14)) + 50, random(0.1, 1), color(random(255), random(255), random(255))));
}
}
void draw() {
background(15, 15, 25);
Star.render();
for (celestial body: planets) {
body.render();
}
tick++;
}
class celestial {
float xpos, ypos;
float orx, ory, size, orrad, orspd;
color rgb, lighter;
celestial(float orx, ory, size, orrad, orspd, color rgb) {
this.orx = orx;
this.ory = ory;
this.size = size;
this.orrad = orrad;
this.orspd = orspd / 10;
this.rgb = rgb;
this.lighter = lerpColor(rgb, color(255, 255, 255), .5);
}
void render() {
xpos = orx + (sin(tick * orspd) * orrad);
ypos = ory + (cos(tick * orspd) * orrad);
xpos += mouseX / -15;
ypos += mouseY / -15;
noStroke();
fill(lighter);
ellipse(xpos, ypos, size * 1.5, size * 1.5);
fill(rgb);
ellipse(xpos, ypos, size, size);
}
}