Prototyping Class
September 29, 2021

# Algorithmic Design App 1

A lively country house.

This project represents my first Homework that has got further development.

The goal was to make static image of a nice country house alive. For this purpose, I created a function that draws a cloud made of three ellipses. The cloud flies in the sky and bouncing from right to left.

Using a spacebar we can stop the cloud at any point of the sky and continue to move it.

When the cloud is covering the sun the picture should be faded into the darkness (this part is under construction)

The code:

```int xPos=960;
int xDir=1;
boolean stop = true;

void setup() {

// declare canvas size
size(1000,600);

// set sky background color
background(#00B7E8);

//set shape outline
strokeWeight(4);
noStroke();

}

void draw() {

// set the sky color
background(#00B7E8);

// set the grass
fill(#10AF4E);
rect(0,400,1000,200);

// set the sun
fill(#FAE30D);
ellipse(60, 60, 80, 80);

// set the cloud color & object position
fill(255);
drawCloud(xPos, 60, 200);

if(stop){

// set the cloud object movement
xPos=xPos-xDir;

if (xPos>width-20 || xPos<20)
{
xDir=-xDir;
}
}

// set house walls
fill(#EABE90);
rect(300,200,400,300);

// set the chimney
fill(#D63B02);
rect(620,100,40,80);

// set the roof
fill(#4D2A07);
triangle(500, 60, 250, 200, 750, 200);

// set the window
fill(#F5F1F0);
stroke(#836054);
strokeWeight(16);
rect(380,260,100,160);

// set the door
fill(#F5F1F0);
stroke(#836054);
rect(520,260,100,230);

// set the tree
fill(#4D2A07);
noStroke();
triangle(860, 260, 840, 500, 880, 500);
fill(#10AF4E);
ellipse(860, 260, 100, 120);
}

void keyPressed(){
// Update boolean value
stop = !stop;
}

// set the cloud object based on 3 ellipses
void drawCloud(float cloudX, float cloudY, float flakeSize) {
float flakeDistance = flakeSize / 3;

fill(255);
noStroke();

// lower-left flake
ellipse(cloudX - flakeDistance, cloudY + flakeDistance*0.5, 120, 120);

// lower-right flake
ellipse(cloudX + flakeDistance, cloudY + flakeDistance*0.3, 150, 150);

// center flake
fill(255);
ellipse(cloudX, cloudY, flakeSize, flakeSize);
}```