Assignment 2: Just A Speck Of Life In This Universe

My inspiration for this assignment came from when I went camping in the desert last semester with my peers. There we were, sitting under the night sky, gazing at the stars and getting lost in the moment. We were talking about how the “small” stars we see are actually ginormous balls of fire flying around in space. We think it’s small because of how far they are. And then I started to ponder, how anyone seeing our world would think the same thing. An insignificant flying rock in mid-space. At that moment, I felt so small. My actions seemed inconsequential.

The power of gravity from the Sun held our Solar System together for so long and will do so for many more millennia. And what I do now or in the next 10 years can’t possibly change the trajectory of Earth. And I guess that’s why I wanted to create our Solar System as the project. And intentionally made it not-interactive to depict that we have no control over this captivating phenomenon.

A particular code I’m fairly proud of is creating randomized stars to depict constellations and making the planets with their respective colours, and distances and setting the rotation of the planets around the sun.

// making the planets rotate around the sun
function drawPlanet(name, distance, size, speed, planetColorR, planetColorG, planetColorB) {
  let angle = frameCount * speed;
  let x = width / 2 + distance * cos(angle);
  let y = height / 2 + distance * sin(angle);

  // giving the planets their color
  fill(planetColorR, planetColorG, planetColorB);
  ellipse(x, y, size, size);
}
class Star {
  constructor() {
    this.x = random(width);
    this.y = random(height);
    this.timer = random(0, 4);
  }

  show() {
    fill(255, 255, 255, (0.5 * (Math.sin(this.timer)) + 0.5) * 255);
    ellipse(this.x, this.y, 3, 3);
    this.timer += deltaTime / 1000;
  }
}

I believe I can do better to make the stars appear and disappear a bit slower to make them look like they’re exploding to dust to make them look more realistic. Additionally, I would like to try adding a part where the stars disappear and appear in different positions. Moreover, I would like to add an interactive element which is when I click on a part of the sketch, the stars burst or suddenly appear.

 

Leave a Reply