diff --git a/ReturningValues/ReturningValues.pde b/ReturningValues/ReturningValues.pde index 8b13789..4e5c5bf 100644 --- a/ReturningValues/ReturningValues.pde +++ b/ReturningValues/ReturningValues.pde @@ -1 +1,19 @@ +void setup(){ +size(800,600); +} +void draw(){ +float c = pythagorean(5, 4); +float z = added(3,2,4); +println(z); //print whichever specified +} + +float pythagorean(float a, float b){ + float c = sqrt(pow(a,2)+pow(b,2)); +return c; +} + +float added(float w, float x, float y){ +float z = w + x + y; +return z; +} \ No newline at end of file diff --git a/VoidFunctions/VoidFunctions.pde b/VoidFunctions/VoidFunctions.pde index 8b13789..3f3cf87 100644 --- a/VoidFunctions/VoidFunctions.pde +++ b/VoidFunctions/VoidFunctions.pde @@ -1 +1,45 @@ +void setup(){ +size(800,600); +background(0); +} +void draw(){ +drawRandomRect(); +drawBlueSquare(); +drawMouseCircle(); +} + +void drawBlueSquare(){ + float side = random(10,50); + noStroke(); + fill(0,0,random(100,200)); + rect(width/2,height/2,side,side); +} + +void drawMouseCircle(){ +float diam = random(10,30); +noStroke(); +setFill(); +ellipse(mouseX,mouseY, diam, diam); +} + +void setFill(){ + float r; + float g; + float b; + float transparency; + r = random(0,255); + g = random(0,255); + b = random(0,255); + transparency = random(50,150); + fill(r, g, b,transparency); +} + +void drawRandomRect(){ + if(mousePressed){ + float leng = random(10,40); + float wid = random(10,40); + noStroke(); + rect(random(width), random(height), leng, wid); + } +} \ No newline at end of file