diff --git a/ReturningValues/ReturningValues.pde b/ReturningValues/ReturningValues.pde index 8b13789..67dad01 100644 --- a/ReturningValues/ReturningValues.pde +++ b/ReturningValues/ReturningValues.pde @@ -1 +1,11 @@ +void setup() { +} + +void draw() { +println(theAnswer()); +} + +int theAnswer() { + return 42; +} \ No newline at end of file diff --git a/VoidFunctions/VoidFunctions.pde b/VoidFunctions/VoidFunctions.pde index 8b13789..4dfcf76 100644 --- a/VoidFunctions/VoidFunctions.pde +++ b/VoidFunctions/VoidFunctions.pde @@ -1 +1,33 @@ +void setup() { + //canvas size + size(800, 600); +} +void draw() { + //black background + background(0); + //three functions + blueSquare(); + mouseCircle(100,0,255); + randomTriangle(); +} + +//draw blue square at center +void blueSquare() { + fill(0, 0, 255); + rect(375, 275, 50, 50); +} + +//draw circle at mouse +void mouseCircle(float red, float green, float blue) { + fill(red, green, blue); + ellipse(mouseX, mouseY, 30, 30); +} + +//draw random triangles when mouse pressed +void randomTriangle() { + fill(255,255,255); + if (mousePressed) { + triangle(random(800), random(600), random(800), random(600), random(800), random(600)); + } +} \ No newline at end of file