diff --git a/ReturningValues/ReturningValues.pde b/ReturningValues/ReturningValues.pde index 8b13789..d79c004 100644 --- a/ReturningValues/ReturningValues.pde +++ b/ReturningValues/ReturningValues.pde @@ -1 +1,25 @@ +void setup(){ + size(800,600); +} +void draw(){ + //provides a, b, and c variables for calculation functions + float c = pythagorean(6, 50); + float d = addThreeNumbers(4, 4, 4); + //draws rectangles + rect(width/2, height/2, c, c); + rect(width/3, height/2, d, d); + //prints values for c and d in command line + println(c); + println(d); +} + +float pythagorean(float a, float b){ + float c = sqrt((a*a)+(b*b)); + return c; +} + +float addThreeNumbers(float a, float b, float c){ + float d = (a+b+c); + return d; +} \ No newline at end of file diff --git a/VoidFunctions/VoidFunctions.pde b/VoidFunctions/VoidFunctions.pde index 8b13789..6db893b 100644 --- a/VoidFunctions/VoidFunctions.pde +++ b/VoidFunctions/VoidFunctions.pde @@ -1 +1,30 @@ +void setup(){ + size(600, 600); + background(0); + rectMode(CENTER); +} +void drawBlueSquare(){ + float sz = 50; + fill(0, 0, 255); + rect(width/2, height/2, sz, sz); +} + +void drawMouseEllipse(color userColor){ + float sz = 30; + fill(userColor); + ellipse(mouseX, mouseY, sz, sz); +} + +void drawRedTriangle(){ + fill(255, 0, 0); + triangle(30, 75, 58, 20, 86, 75); +} + +void draw(){ + drawBlueSquare(); + drawMouseEllipse(color(30, 150, 90)); + if (mousePressed == true){ + drawRedTriangle(); + } +} \ No newline at end of file