Removing a few Basics examples

This commit is contained in:
Casey Reas
2011-09-06 00:52:15 +00:00
parent 136b97bea5
commit d9f585f3a9
6 changed files with 7 additions and 236 deletions
@@ -1,8 +1,8 @@
/**
* Points and Lines.
*
* Constructing a simple dimensional form with lines and rectangles.
* Changing the value of the variable 'd' scales the image.
* Points and lines can be used to draw basic geometry.
* Change the value of the variable 'd' to scale the form.
* The four variables set the positions based on the value of 'd'.
*/
@@ -1,82 +0,0 @@
/**
* Simple Curves.
*
* Simple curves are drawn with simple equations.
* By using numbers with values between 0 and 1 in
* the equations, a series of elegant curves
* are created. The numbers are then scaled to fill the screen.
*/
void setup() {
size(640, 360);
colorMode(RGB, 100);
smooth();
background(0);
noFill();
noLoop(); // Run once and stop
}
void draw() {
stroke(40);
beginShape();
for(int i = 0; i < width; i++) {
vertex(i, singraph((float)i/width)*height);
}
endShape();
stroke(55);
beginShape();
for(int i = 0; i < width; i++) {
vertex(i, quad((float)i/width)*height);
}
endShape();
stroke(70);
beginShape();
for(int i = 0; i < width; i++) {
vertex(i, quadHump((float)i/width)*height);
}
endShape();
stroke(85);
beginShape();
for(int i = 0; i < width; i++) {
vertex(i, hump((float)i/width)*height);
}
endShape();
stroke(100);
beginShape();
for(int i = 0; i < width; i++) {
vertex(i, squared((float)i/width)*height);
}
endShape();
}
float singraph(float sa) {
sa = (sa - 0.5) * 1.0; //scale from -1 to 1
sa = sin(sa*PI)/2 + 0.5;
return sa;
}
float quad(float sa) {
return sa*sa*sa*sa;
}
float quadHump(float sa) {
sa = (sa - 0.5); //scale from -2 to 2
sa = sa*sa*sa*sa * 16;
return sa;
}
float hump(float sa) {
sa = (sa - 0.5) * 2; //scale from -2 to 2
sa = sa*sa;
if(sa > 1) { sa = 1; }
return 1-sa;
}
float squared(float sa) {
sa = sa*sa;
return sa;
}
@@ -1,51 +0,0 @@
/**
* Vertices.
*
* The beginShape() function begins recording vertices
* for a shape and endShape() stops recording.
* A vertex is a location in space specified by X, Y,
* and sometimes Z coordinates. After calling the beginShape() function,
* a series of vertex() functions must follow.
* To stop drawing the shape, call the endShape() functions.
*/
size(640, 360);
background(0);
noFill();
translate(140, 20);
scale(1.5);
strokeWeight(.5);
stroke(102);
beginShape();
curveVertex(168, 182);
curveVertex(168, 182);
curveVertex(136, 38);
curveVertex(42, 34);
curveVertex(64, 200);
curveVertex(64, 200);
endShape();
stroke(51);
beginShape(LINES);
vertex(60, 40);
vertex(160, 10);
vertex(170, 150);
vertex(60, 150);
endShape();
stroke(126);
beginShape();
vertex(60, 40);
bezierVertex(160, 10, 170, 150, 60, 150);
endShape();
stroke(255);
beginShape(POINTS);
vertex(60, 40);
vertex(160, 10);
vertex(170, 150);
vertex(60, 150);
endShape();