Concept: For this assignment, I decided to go with a more creative approach for the self-portrait by involving my interest in space science. I attempted to draw a female astronaut that represents the field I would like to explore and learn more about in the future, with an animated starry background and a few planets.
Code:
I’m proud of the code snippet below because it was challenging to make it function the way I planned it to be. I initialized an array of stars with random positions at two different speeds, and the function keeps updating the position of the stars once they reach the end of the canvas, making them to start from the top again. That’s how it created the illusion of stars falling.
Let stars = []; Function draw() { // Displaying the stars and updating for (let i = 0; i < stars.length; i++) { let star = stars[i]; star. y += star. speed; //star goes downwards if (star. y > height) { star. y = 0; // This will reset the star's position if it goes off-screen } fill(255); ellipse(star.x, star.y, 4.5, 4.5); } // Stars in the background function drawStars(numStars) { // white dots as stars fill(255); for (let i = 0; i < numStars; i++) { stars.push({ x: random(width), y: random(height), speed: random(0.5, 2), //speed for every star }); } } }
Reflection:
In this assignment, I would say that I did a good job with what I had in mind but I could’ve done a better portrait in addition to making the planets move in a certain motion. For future assignments and tasks, I would like to do something that is more challenging for myself through videos online and other sources. I hope to gain more experience on creating curves and lines to be able to express myself better.