diff --git a/Documentation1.md b/Documentation1.md index 28f94fa..2dc20a4 100644 --- a/Documentation1.md +++ b/Documentation1.md @@ -1,19 +1,42 @@ -# Name: +# Name: Annie Zhou ## Examples: -Insert examples here. +void sinwave(){ + fill(255); + angle += radians(1); + float y = sin(angle)*300 + height/2; + x+=8; + y+=randomNumber(); + if(sizeLimit()){ + x=0; + } + ellipse(x, y, major(mouseX,mouseY),minor(mouseX,mouseY)); +} +float major(float a, float b){ + return a%4+b%3; +} +float minor(float a, float b){ + return (a+b)/15; +} +float randomNumber(){ + return random(0,20); +} +boolean sizeLimit(){ + return x>width; +} ## Description: -Insert description here +This graphic function creates a sin wave of ellipses of sizes that vary based on where your mouse is. ## Syntax: -Demonstrate syntax here - +void name(){} +void name(int parameters){} +void name(float parameters){} +void name(boolean parameters){} ##Parameters: -Name and describe parameters here - +You can have as many parameters as you like. Parameters have a primitive before them ##Returns: -What type of data does it return? +no data returned ##Other notes: Anything else? diff --git a/Documentation2.md b/Documentation2.md index 28f94fa..dcd988b 100644 --- a/Documentation2.md +++ b/Documentation2.md @@ -1,19 +1,27 @@ -# Name: +# Name: Annie Zhou ## Examples: -Insert examples here. +float pyth(float x, float y){ + hyp = sqrt(sq(x)+sq(y)); + return hyp; +} ## Description: -Insert description here +Returns the hypotenuse of a triangle ## Syntax: -Demonstrate syntax here +float name(){} +float name(parameters){} + + + +name - name of function ##Parameters: -Name and describe parameters here +You can have as many parameters as you like. ##Returns: -What type of data does it return? +a float ##Other notes: Anything else? diff --git a/Documentation3.md b/Documentation3.md index 28f94fa..b3c7d12 100644 --- a/Documentation3.md +++ b/Documentation3.md @@ -1,19 +1,25 @@ -# Name: +# Name: Annie Zhou ## Examples: -Insert examples here. +float[] unitVector(float hyp){ + float [] thing= new float [2]; + thing[0] = mouseX/hyp; + thing[1] = mouseY/hyp; + return thing; +} ## Description: -Insert description here +Physics function that returns the unit vector of your mouse from the origin. ## Syntax: -Demonstrate syntax here +float[] name(){} +float[] name(parameters){} ##Parameters: -Name and describe parameters here +any parameters. I used a float found in a previous function. ##Returns: -What type of data does it return? +an array with 2 floats ##Other notes: Anything else? diff --git a/sketch_151209a/sketch_151209a.pde b/sketch_151209a/sketch_151209a.pde new file mode 100644 index 0000000..42ccac0 --- /dev/null +++ b/sketch_151209a/sketch_151209a.pde @@ -0,0 +1,60 @@ +float hyp; +float angle = 0; +float x = 0; +void setup(){ + size(600,600); + background(0); +} +void draw(){ + sinwave(); + unitVector(pyth(mouseX,mouseY)); +} + +//graphic function +//makes a sin wave continuously across the screen +void sinwave(){ + fill(255); + angle += radians(1); + float y = sin(angle)*300 + height/2; + x+=8; + y+=randomNumber(); + + //once sin wave reaches end, restarts at a different place + if(sizeLimit()){ + x=0; + } + //turns wave into circles + ellipse(x, y, major(mouseX,mouseY),minor(mouseX,mouseY)); +} +//varies major axis of ellipse +float major(float a, float b){ + return a%4+b%3; +} +//varied minor axis of ellipse +float minor(float a, float b){ + return (a+b)/15; +} +//where the y posiion of your ellipse goes +float randomNumber(){ + return random(0,20); +} +//tells once sin wave goes to end of screen +boolean sizeLimit(){ + return x>width; +} + +//math based function +//gives the hypotenuse length from (0,0) to parameters(where mouse is) +float pyth(float x, float y){ + + hyp = sqrt(sq(x)+sq(y)); + return hyp; +} +//physics based function +//finds the unit vector of where your mouse is. +float[] unitVector(float hyp){ + float [] thing= new float [2]; + thing[0] = mouseX/hyp; + thing[1] = mouseY/hyp; + return thing; +} \ No newline at end of file