Description
This page is generated from the Processing project folder at /2017/Lessons/Functions_within_variables_01/Functions_within_variables_01.pde.
Archive
No companion assets were found in this sketch folder.
/*
Creating functions within variables
02/21/2017
*/
float centerX, centerY, d;
float distance(float centerX, float centerY) {
float a = centerX - mouseX;
float b = centerY - mouseY;
float c = sqrt(sq(a) + sq(b));
return c;
}
void setup() {
size(400, 400);
centerX = centerY = d = 200;
}
void draw() {
background(#000000);
if (distance(centerX, centerY) < d/2) {
fill(#FFFFFF);
ellipse(centerX, centerY, d, d);
}
} This page is generated from the Processing project folder at /2017/Lessons/Functions_within_variables_01/Functions_within_variables_01.pde.
No companion assets were found in this sketch folder.