9-10XIST
Coding for COVID-19
Video Demonstration
Drop[] drops = new Drop[100] ; //this is an array for making 100 drops to fall to make more increase the number
PFont f;
​
void setup(){
size(840,580); //size of the screen
for (int i= 0; i < drops.length; i++) { // creating a loop to add 100 drops into the array
drops[i] = new Drop();
f = createFont ("Arial",24);
}
}
void draw() {
background(0); //colour of the screen
for (int i = 0; i < drops.length; i++) { //creating a loop to draw 100 drops
drops[i].fall();
drops[i].show();
}
}
​
-----------------------------------------------------------------------------------------------
​
//declare data types
int num;
int time;
class Drop {
float x = random(height) ; //random location to starT on the screen
float y = random(-100,-50); // object starting randomly off the screen
float yspeed = random(4, 10); //random speed of the drop
void fall() { //function to make it fall
y= y + yspeed;
yspeed = yspeed - 0.1; //increase speed while falling
if (y> height) {
y = random (-150, -140); // this will make the drop reset back to the top to star again
yspeed = random(4, 10); //reset speed
}
}
void show() { // function to show or rendered on the screen
text("overwhelmed", x, y+10); // here we are creating a text to drop
textSize(random (20,50)) ; // random text size
num=round(random(1,6)); //we are creating a random colour generator for the text
println("num = " +num);
time++;
if(time%0.5==0)
{
if (num==1) fill(#778DA9);
if (num==2) fill(#96BBBB);
if (num==3) fill(#558C8C);
if (num==4) fill(#EAEFBD);
if (num==5) fill(#FBD1A2);
if (num==6) fill(#D6D3F0);
}
}
}
Code
The word I chose to represent my emotions during COVID-19 was ‘overwhelmed’. This is because there is so much going on around us that there’s just too much to think about. Ensuring that we are safe as well as everyone else. We must follow the rules to protect everyone particularly those that are especially vulnerable to getting sick. On top of that, we have mountains of assignments that need to be completed.
To represent this word, I was inspired by four different exercises that we had done. This includes ‘falling like the rain’, ‘drop’, ‘Blinking text’ and ‘Letter Sizing’. The base of the code is similar to the one I created in my “drop” exercise. The ‘falling like the rain’ exercise was already combined into the ‘drop’ exercise. I chose those two exercises because there are so many words falling and floating that it’s too overwhelming. To further add to the overwhelmingness of the two exercises, I added the random text size variable from the exercise ‘letter sizing’. The random sizing created a ‘chaotic’ look in the ‘letter sizing’ exercise so I wanted to see if I could add that look to my final code. It was perfect but I didn’t stop there. I went further by using the ‘blinking text’ exercise to randomise the colours of the text. I really liked the colour changing of the background in the ‘blinking text’ exercise so I was hoping I could do the same in my final code. Instead of the background changing colours, the words change colours as they fall. As the words fall and float, they not only change in size but in colour as well. There were so many colours that it was just too overwhelming. To solve this I went through the process of limiting the range of colours to six and changing the colours to see what fit best. Now the code was close to being done. The last few things I did was changing the position that the object started off the screen and when the drop will reset back to the top.
My final code is able to express the feeling of being overwhelmed because there’s so much happening. The word “overwhelmed” is falling everywhere and the size of everything is different. The different sizes of the words represent the different things that pile up to cause us to become overwhelmed. But as the words fall, they float back up and slowly the words aren’t all piled up and you can clearly see the word “overwhelmed”. Soon the words are all gone. This shows how everything will be alright in the end.
This code uses many functions which can be found on the functions page.