Class Physical computing
Lab partner No. Did this all by myself. Yay.
Assignment Learning the basics of programming with
Processing
Time to learn programming in a new language. Why? Because you can do cool stuff. Like copying art work that famous artists have made:

This is my copy of an artwork called Growth and Youth, and is originally made by Josef Albers.
But before I could make that art work, I had to learn some basic stuff about creating shapes and playing with colors.
BASIC STRUCTURE
void setup()
{
size(640, 480); //Setting width, height
background(0); //Background color black
println(“Oh, what a JOYFUL message this is!”); //Printing message
}
FIRST SKETCH
Learning how to draw different shapes.
void setup()
{
size(400, 400); //Setting width, height
background(#ffffff); //Background color white
}
void draw ()
{
point(30,30); // x, y
line(30,50, 80,50); //x1, y1, x2, y2
triangle(30,70, 80,70, 55,100); //x1, y1, x2, y2, x3, y3
quad(30,120, 80,120, 80,150, 30,150); //x1, y1, x2, y2, x3, y3, x4, y4
rect(30,160, 30,60); //x1, y1, width, height
ellipse(50,280, 40,80); // x, y, width, height
}
FULL COLOR
Adding color to the equation.
void setup()
{
size(400, 400); //Setting width, height
background(#e8e8e8); //Background color
}
void draw ()
{
//POINT
stroke(#000000);
point(30,30); // x, y
//LINE
stroke(#000000);
line(30,50, 80,50); //x1, y1, x2, y2
//TRIANGLE
stroke(#00a666);
fill(#bdefdc);
triangle(30,70, 80,70, 55,100); //x1, y1, x2, y2, x3, y3
//QUAD
stroke(#a60046);
fill(#f5cfdf);
quad(30,120, 80,120, 80,150, 30,150); //x1, y1, x2, y2, x3, y3, x4, y4
//RECT
stroke(#fc9c06);
fill(#f8e7cb);
rect(30,160, 30,60); //x1, y1, width, height
//ELLIPSE
stroke(#2e06fc);
fill(#dfd9fc);
ellipse(50,280, 40,80); // x, y, width, height
}
Now I was ready to copy the great artists (mainly the great artists that play with basic shapes, though):
ALBERS
// Growth and Youth by Josef Albers
void setup()
{
size(480, 480); //Setting width, height
background(#9badaf); //Background color gray
}
void draw ()
{
//1st rect
stroke(#c6d7de);
fill(#d4a00d);
rect(23,23, 433,433); //x1, y1, width, height
//2nd rect
noStroke(); //No stroke for this and the next rectangles
fill(#ddb834);
rect(68,88, 343,343); //x1, y1, width, height
//3rd rect
fill(#dec83e);
rect(112,142, 257,257); //x1, y1, width, height
//4th rect
fill(#d7d05e);
rect(155,195, 170,170); //x1, y1, width, height
}
CREATING A PAINT PROGRAM
Time to make a basic paint program. In my final program you can do some fabulous painting with my specialized yellow dot paintbrush, like this:

You can also clear the screen by clicking the white button. Try my paint program! This is how I started out:
void setup()
{
size(480, 600); //Setting width, height
background(#9badaf); //Background color
}
void draw()
{
//MAIN CIRCLES WHERE MOUSE POINTER IS
//Large circle
fill(#d4a00d); //Fill color
noStroke();
ellipse(mouseX,mouseY,50,50);
//Smaller circle
fill(#ddb834);
ellipse(mouseX,mouseY,35,35);
//Smallest circle
fill(#dec83e);
ellipse(mouseX,mouseY,15,15);
//SMALL DOTS OUTSIDE OF MOUSE POINTER
fill(#dec83e);
ellipse(mouseX+30,mouseY+30, 15,15);
fill(#dec83e);
ellipse(mouseX-30,mouseY-30, 10,10);
fill(#dec83e);
ellipse(mouseX-50,mouseY, 5,5);
fill(#dec83e);
ellipse(mouseX,mouseY-50, 10,10);
fill(#dec83e);
ellipse(mouseX+30,mouseY-20, 15,15);
fill(#dec83e);
ellipse(mouseX+50,mouseY, 5,5);
}
PAINTING WITHIN A CERTAIN AREA
void setup()
{
size(480, 600); //Setting width, height
background(#9badaf); //Background color
stroke(#ffffff);
noFill();
rect(30,30, 300,300); //Area to draw in
}
void draw()
{
//CHECKING IF MOUSE PRESSED AND INSIDE RIGHT AREA
if ((mousePressed == true) && (mouseX>82) && (mouseX<278) && (mouseY>85) && (mouseY<293)) {
//MAIN CIRCLES WHERE MOUSE POINTER IS
//Large circle
fill(#d4a00d); //Fill color
noStroke();
ellipse(mouseX,mouseY,50,50);
//Smaller circle
fill(#ddb834);
ellipse(mouseX,mouseY,35,35);
//Smallest circle
fill(#dec83e);
ellipse(mouseX,mouseY,15,15);
//SMALL DOTS OUTSIDE OF MOUSE POINTER
fill(#dec83e);
ellipse(mouseX+30,mouseY+30, 15,15);
fill(#dec83e);
ellipse(mouseX-30,mouseY-30, 10,10);
fill(#dec83e);
ellipse(mouseX-50,mouseY, 5,5);
fill(#dec83e);
ellipse(mouseX,mouseY-50, 10,10);
fill(#dec83e);
ellipse(mouseX+30,mouseY-20, 15,15);
fill(#dec83e);
ellipse(mouseX+50,mouseY, 5,5);
}
}
ADDING BUTTON TO CLEAR AREA
void setup()
{
size(480, 600); //Setting width, height
background(#9badaf); //Background color
}
void draw() {
//AREA TO DRAW IN
stroke(#ffffff);
noFill();
rect(30,30, 300,300);
//BUTTON
stroke(#ffffff);
fill(#ffffff);
rect(30,350, 100,30);
//CHECKING IF MOUSE PRESSED AND INSIDE RIGHT AREA
if ((mousePressed == true) && (mouseX>82) && (mouseX<278) && (mouseY>85) && (mouseY<293)) {
//MAIN CIRCLES WHERE MOUSE POINTER IS
//Large circle
fill(#d4a00d);
noStroke();
ellipse(mouseX,mouseY,50,50);
//Smaller circle
fill(#ddb834);
ellipse(mouseX,mouseY,35,35);
//Smallest circle
fill(#dec83e);
ellipse(mouseX,mouseY,15,15);
//SMALL DOTS OUTSIDE OF MOUSE POINTER
fill(#dec83e);
ellipse(mouseX+30,mouseY+30, 15,15);
fill(#dec83e);
ellipse(mouseX-30,mouseY-30, 10,10);
fill(#dec83e);
ellipse(mouseX-50,mouseY, 5,5);
fill(#dec83e);
ellipse(mouseX,mouseY-50, 10,10);
fill(#dec83e);
ellipse(mouseX+30,mouseY-20, 15,15);
fill(#dec83e);
ellipse(mouseX+50,mouseY, 5,5);
}
//CLEARING AREA WHEN BUTTON PRESSED
if ((mousePressed == true) && (mouseX>29) && (mouseX<131) && (mouseY>349) && (mouseY<380)){
//Make button gray when pressed
stroke(#ffffff);
fill(#cccccc);
rect(30,350, 100,30);
//Redraw area to draw in - clearing area
stroke(#ffffff);
fill(#9badaf);
rect(30,30, 300,300);
}
}