Workshop 2 - Griffith-ICT/1701ICT-Creative-Coding GitHub Wiki

Exercise 1 (0.25 marks)

Draw an ellipse by adding the following code to the draw() function:

ellipse(100, 100, 100, 100);

Change the code so that the ellipse is drawn at the following co-ordinates:

x: 50 pixels

y: 50 pixels

Exercise 2 (0.25 marks)

Draw a rectangle at the (x,y) co-ordinates (100,100) with a width of 60 pixels and a height of 30 pixels.

Exercise 3 (0.5 marks)

Use the fill() function to change the colour of the ellipse to pink and the colour of the rectangle to blue.

Exercise 4 (0.5 marks)

Draw the other shapes of line and triangle at any location and size as long as they don't overlap the ellipse and rectangle and each other.

Exercise 5 (0.5 marks)

Draw five diagonal lines using a for loop. Start the top left of the line at (50,50) and the bottom right of the line at (100, 100). The lines will have a vertical spacing of 5 pixels between each.

Extension Exercise

Write the code to reproduce this:

Hint: There is an alpha change