FUNDAMENTALS OF PROGRAMMING SM1204 Semester A 2011
Due date 20 Oct Collection via ACS Assignment 1
Requirements o Create your own drawing brushes (20%) o Use of "if-else" or "for" structures (20%) o Use of random or noise functions (20%) o Apply to positions / colors / sizes of elements you draw o With basic user interaction (20%) o e.g. mousePressed, mouseX, mouseY o Creative graphics (20%)
Example
Example - Circles float d = dist(pmouseX, pmouseY, mouseX, mouseY); noFill(); stroke(255); for (int i=0; i<5; i++) { float s = (d+4)*(i+1); ellipse(mouseX, mouseY, s, s); }
Example - Grids fill(0, 10); noStroke(); rect(0, 0, width, height); if (mousePressed == true) { int r = mouseY / 15; int c = mouseX / 15; fill(255); rect(c*15+1, r*15+1, 14, 14); }
Useful Functions & References o dist(x1, y1, x2, y2) o Calculates the distance between two points o mouseX, mouseY o the current coordinate of the mouse o pmouseX, pmouseY o The position of the mouse in the previous frame