For this weeks homework, I want you to draw a portrait in p5, using the 2D Primitive Shape functions, color functions, positions functions, and order of operation techniques.
More specifically, I want you to either draw a self-portrait (i.e. of yourself) or a portrait of a monster (imaginary or based from someone else’s).
This assignment is your first chance to really dig into programming with p5. It will test you and your ability to comprehend what is going on right now in this class.
To work on this assignment, I would proceed as follows;
Play a whole bunch before starting in earnest this week. Give yourself time to make silly drawings and explore how all of the functions introduced work. Then;
empty-project/
directory, labelling it hw-4/
.sketch.js
file.setup()
function
draw()
function
push()
& pop()
)translate()
At this point, you sketch.js file might look something like;
function setup() {
// create a canvas to draw my portrait on
createCanvas( 600, 900 );
}
function draw() {
// set the background color
background( 'rgb(78, 249, 135)' );
// *****************************************************
// create a sandbox for the entire character
push();
// move the entire grid for this character to the center of the canvas
translate( 300, 450 );
// ** BODY **********************************
push();
// body code goes here
pop();
// **END BODY**
// ** ARMS **********************************
push();
// arms code goes here
pop();
// **END ARMS**
// ** HEAD **********************************
push();
// head code goes here
// make skull first
// **MOUTH**
push();
// mouth code goes here
pop();
// **END MOUTH**
// **EYES**
push();
// eye code goes here
pop();
// **END EYES**
pop();
// **END HEAD**
// ** END CHARACTER SANDBOX *******************
pop();
}
This work-process is one we will discuss often throughout the semester. Essentially, the above code structure helps your break this BIG PROBLEM into smaller sub-problems. This is done by identifying each sub-section of the code ahead of time, and working just on each sub-section. You of course could go even further, breaking the “body” into additional sub-sections/sub-problems.
After breaking the code into sub-sections, start to work on each section, remembering to check your work often in the browser.
You should also make frequent commits in your repository as you make incremental progress (i.e. after finishing the main structure, after completing the body, etc. )
This homework will take quite a bit of time. Give yourself plenty of time to do it. You should also be gentle on yourself. There is no point in beating yourself up when you get stuck. You will get stuck! How Exciting! Just play around, be methodical in your approach; check the error console in your browser, ask colleagues for help, post to the issues board, take advantage of the lab, and come to my office hours
Be gentle on yourself, this process takes time, lots of energy, and lots more time.
When you have finished with your portrait, you should;