Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions ReturningValues/ReturningValues.pde
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@

void setup() {

}

void draw() {
println(meterTocenti(10));

}



float meterTocenti(float meter){
float centi = meter/100;
return centi;


}
47 changes: 47 additions & 0 deletions VoidFunctions/VoidFunctions.pde
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
void setup(){

size(500,500); //set size
noStroke(); //remove stroke



}




void draw(){

mousecircle(0,255,255); //use the mousecircle function to draw a green circle at the mouse
blueSquare(); //use the bluesquare function to draw a blue circle at the center
blackcirclesquare(); //use he blackcirclesquare function to draw black circle and square
}







void mousecircle(float r, float g, float b){ //name the function and give it three values that user can define


fill(r,g,b); //fill the colors with variables to be defined
ellipse(mouseX,mouseY,30,30); //draw a circle at the mouse and 30 diameter

}

void blueSquare(){ //name the function
rectMode(CENTER); //change the rectangle mode to center
fill(0,0,255); //fill blue
rect(width/2,height/2,50,50); //draw the rectangle


}
void blackcirclesquare(){ //name the function
fill(0); //fill black
rect(random(width),random(height),random(5,50),random(5,50)); //draw random rectangles between the canvas between the size 5 and 50
ellipse(random(width),random(height),random(5,50),random(5,50)); //draw random circles between the canvas between the size 5 and 50
if(mousePressed){ //if mouse is pressed set the back ground to white and erase the other things
background(255); //redraw the background
}
}