Skip to content →

icm / week 01

For the first week of ICM we were introduced to some programming concepts and in the end of the class we started programming a bit on p5, which is a variation of processing – I hope this will be a smoother learning curve.

Our homework was to create an image through shapes on p5.

So I created the bold boy:

renata_week01

For this exercise, I had to think a lot about coordinates, going step by step and understanding the order of the elements. I had some trouble to find out some coordinate points (despite my math was right) and with setting the color for different elements. The way I solved this issue was probably not the more objective, but that worked anyway =) and to create a new shape I did some arcs, lines and a rectangle to complete the “fill” of the shirt.

function setup() {
createCanvas(600,600);
background(151,188,228);
//grass
noStroke();
fill(0,255,0);
rect(0,402,600,600);
stroke(1);
line(0,402,600,402);
//head
stroke(1);
fill(255);
ellipse(300,300,50,50);
point (290,290);
point (310,290);
arc(300,300,5,5,0,-90);
arc(300,311,6,5,0,85);
//body
arc(300,340,30,30,135,0);
line(284.5,340,284.5,365); //arm 1
rect(281,365,3.5,4,5,0,5,5); //hand 1
line(314.5,340,314.5,355); //arm 2 pt 1
line(314.5,355,322.5,350); //arm 2 pt 2
ellipse(322.5,350,4,4.7); //hand 2
noStroke();
rect(289.5,340,20,30);
stroke(1);
line(289.5,340,289.5,370); //shirt lenght
line(309.5,340,309.5,370); //shirt lenght
line(284.5,340,289.5,340); //shirt sleeve
line(309.5,340,314.5,340); //shirt sleeve
line(289.5,370,309.5,370); //shirt end
rect(290.5,370,9,15);//short 1
rect(299.5,370,9,15);//short 2
line(297.5,385,297.5,400); // leg 1
line(301.5,385,301.5,400); // leg 2
rect(292.5,400,5,3,5,0,0,5); // shoe 1
rect(301.5,400,5,3,0,5,5,0); // shoe 2
}
function draw() {
}

You can see the code actually running on this link.

This was a good exercise to warm up and remember some of the basics concepts of javascript programming, looking forward to better understand p5 and javascript!

Published in fall 2015 icm

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *