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
22 changes: 22 additions & 0 deletions ReturningValues/ReturningValues.pde
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
float theta = 0;
float thetaStart = 0;
float circleSize = 100;

void setup() {
colorMode(HSB, 360, 100, 100, 100);
size(2800, 1200);
}

void draw() {
theta = thetaStart;
background(0, 0, 100);
stroke(3);
println(sin(theta));
for (int x = 0; x < width; x += circleSize - 20) {
noStroke();
fill(map(x, 0, width, 0, 360), 100, 100, 50);
float y = map(sin(theta), -1, 1, height*.25, height*.75);
ellipse(x, y, circleSize, circleSize);
theta += .3;
}
thetaStart += .005;
}
29 changes: 29 additions & 0 deletions VoidFunctions/VoidFunctions.pde
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
void setup() {
size(800, 600);
}

void draw() {
DrawABlueSquare();
DrawACircle(100,0,200);
DrawATriangle(150);
}

void DrawABlueSquare() {
fill(#082EFF);
rect(375, 275, 50, 50);
}

void DrawACircle(float red, float green, float blue){
fill(red,green,blue);
ellipse(mouseX,mouseY,30,30);
}

void DrawATriangle(float d){
fill(#0DA026);
triangle(40,75,60,20,d,d);
}

/*********************************
how to define function: dataType name (parameters- that are not included in code){
block of code
}
/**********************************/