To view this content, you need to install Java from java.com

Source code: a_basic_shapes

Built with Processing

No. 1
basic shapes by paul glennon 2005

As this was my first sketch the idea was to draw and colour basic shapes. The only real difficulty was the triangle. There is no width and height, just three sets of numbers for each corner of the triangle.

One tip that was useful when moving the triangle:

across - add equal amounts to 1st, 3rd and 5th numbers.

down - add equal amounts to 2nd, 4th and 6th numbers.

//basic shapes by paul glennon 2005

size(300, 200);
background(0);
noStroke();

fill(255, 0, 0); //fill with the colours (R,G,B)
rect(120, 70, 60, 60); //this will set position and size (x,y,w,h)

fill(0,0,255);
ellipse(70,100,60,60); //(x or across, y or down,w,h)

fill(255,255,0);
triangle(194, 130, 224, 70, 257, 130); // (x1,y1 - x2,y2 - x3,y3)