FUNDAMENTALS OF PROGRAMMING SM1204 SEMESTER A 2012
ASSIGNMENT 1 DUE DATE 30 OCT COLLECTION VIA ACS
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 o random(low, high) o Generate random numbers (floating-point value) between low and high