diff --git a/java/examples/Basics/Arrays/Array/Array.pde b/java/examples/Basics/Arrays/Array/Array.pde index dd84f41e8..4bafa8033 100644 --- a/java/examples/Basics/Arrays/Array/Array.pde +++ b/java/examples/Basics/Arrays/Array/Array.pde @@ -25,19 +25,25 @@ void setup() { void draw() { + int y1 = 0; + int y2 = height/3; for (int i = 0; i < width; i++) { stroke(coswave[i]*255); - line(i, 0, i, height/3); + line(i, y1, i, y2); } + y1 = y2; + y2 = y1 + y1; for (int i = 0; i < width; i++) { stroke(coswave[i]*255 / 4); - line(i, height/3, i, height/3*2); + line(i, y1, i, y2); } - + + y1 = y2; + y2 = height; for (int i = 0; i < width; i++) { stroke(255 - coswave[i]*255); - line(i, height/3*2, i, height); + line(i, y1, i, y2); } } diff --git a/java/examples/Basics/Arrays/Array2D/Array2D.pde b/java/examples/Basics/Arrays/Array2D/Array2D.pde index ef749a8f7..c985f834c 100644 --- a/java/examples/Basics/Arrays/Array2D/Array2D.pde +++ b/java/examples/Basics/Arrays/Array2D/Array2D.pde @@ -27,6 +27,10 @@ void setup() { void draw() { background(0); + // This embedded loop skips over values in the arrays based on + // the spacer variable, so there are more values in the array + // than are drawn here. Change the value of the spacer variable + // to change the density of the points for (int y = 0; y < height; y += spacer) { for (int x = 0; x < width; x += spacer) { stroke(distances[x][y]); diff --git a/java/examples/Basics/Arrays/ArrayObjects/ArrayObjects.pde b/java/examples/Basics/Arrays/ArrayObjects/ArrayObjects.pde index 2aa5439a6..a447148ef 100644 --- a/java/examples/Basics/Arrays/ArrayObjects/ArrayObjects.pde +++ b/java/examples/Basics/Arrays/ArrayObjects/ArrayObjects.pde @@ -2,8 +2,6 @@ * Array Objects. * * Demonstrates the syntax for creating an array of custom objects. - * - * Updated 26 February 2010. */ int unit = 40; @@ -12,7 +10,6 @@ Module[] mods; void setup() { size(640, 360); - background(176); noStroke(); int wideCount = width / unit; int highCount = height / unit; diff --git a/java/examples/Basics/Shape/LoadDisplayShape/LoadDisplayShape.pde b/java/examples/Basics/Shape/LoadDisplayShape/LoadDisplayShape.pde index 3b7360cda..5ec111c0b 100644 --- a/java/examples/Basics/Shape/LoadDisplayShape/LoadDisplayShape.pde +++ b/java/examples/Basics/Shape/LoadDisplayShape/LoadDisplayShape.pde @@ -22,6 +22,6 @@ void setup() { void draw(){ background(102); - shape(bot, 110, 90, 100, 100); // Draw at coordinate (10, 10) at size 100 x 100 - shape(bot, 280, 40); // Draw at coordinate (70, 60) at the default size + shape(bot, 110, 90, 100, 100); // Draw at coordinate (110, 90) at size 100 x 100 + shape(bot, 280, 40); // Draw at coordinate (280, 40) at the default size } diff --git a/java/examples/Topics/File IO/LoadingXMLObjects/Bubble.pde b/java/examples/Topics/Advanced Data/LoadingXMLObjects/Bubble.pde similarity index 100% rename from java/examples/Topics/File IO/LoadingXMLObjects/Bubble.pde rename to java/examples/Topics/Advanced Data/LoadingXMLObjects/Bubble.pde diff --git a/java/examples/Topics/File IO/LoadingXMLObjects/LoadingXMLObjects.pde b/java/examples/Topics/Advanced Data/LoadingXMLObjects/LoadingXMLObjects.pde similarity index 100% rename from java/examples/Topics/File IO/LoadingXMLObjects/LoadingXMLObjects.pde rename to java/examples/Topics/Advanced Data/LoadingXMLObjects/LoadingXMLObjects.pde diff --git a/java/examples/Topics/File IO/LoadingXMLObjects/data/bubbles.xml b/java/examples/Topics/Advanced Data/LoadingXMLObjects/data/bubbles.xml similarity index 100% rename from java/examples/Topics/File IO/LoadingXMLObjects/data/bubbles.xml rename to java/examples/Topics/Advanced Data/LoadingXMLObjects/data/bubbles.xml diff --git a/java/examples/Topics/File IO/LoadingXMLObjects/sketch.properties b/java/examples/Topics/Advanced Data/LoadingXMLObjects/sketch.properties similarity index 100% rename from java/examples/Topics/File IO/LoadingXMLObjects/sketch.properties rename to java/examples/Topics/Advanced Data/LoadingXMLObjects/sketch.properties diff --git a/java/examples/Topics/File IO/XMLYahooWeather/XMLYahooWeather.pde b/java/examples/Topics/Advanced Data/XMLYahooWeather/XMLYahooWeather.pde similarity index 100% rename from java/examples/Topics/File IO/XMLYahooWeather/XMLYahooWeather.pde rename to java/examples/Topics/Advanced Data/XMLYahooWeather/XMLYahooWeather.pde diff --git a/java/examples/Topics/Create Shapes/SVGPShape/SVGPShape.pde b/java/examples/Topics/Create Shapes/SVGPShape/SVGPShape.pde deleted file mode 100644 index 6357a007f..000000000 --- a/java/examples/Topics/Create Shapes/SVGPShape/SVGPShape.pde +++ /dev/null @@ -1,24 +0,0 @@ -/** - * SVGPShape - * - * How to load an SVG into a PShape - */ - -// PShape object -PShape svg; - -void setup() { - size(640, 360, P2D); - smooth(); - // Load the SVG - svg = loadShape("star.svg"); -} - -void draw() { - background(255); - // Draw PShape at mouse location - translate(mouseX, mouseY); - shapeMode(CENTER); - shape(svg); -} - diff --git a/java/examples/Topics/Create Shapes/SVGPShape/data/star.svg b/java/examples/Topics/Create Shapes/SVGPShape/data/star.svg deleted file mode 100644 index 697b2f92d..000000000 --- a/java/examples/Topics/Create Shapes/SVGPShape/data/star.svg +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - image/svg+xml - - - - - - - - diff --git a/java/examples/Topics/File IO/SaveManyImages/SaveManyImages.pde b/java/examples/Topics/File IO/SaveManyImages/SaveManyImages.pde deleted file mode 100644 index ac996b4f8..000000000 --- a/java/examples/Topics/File IO/SaveManyImages/SaveManyImages.pde +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Save Many Images. - * - * The saveFrame() function allows you to save images from - * a program while it is running. This example saves the first - * 50 frames of a program. These images can be imported into - * animation software or QuickTime and then saved as a movie. - */ - -float x = 33; -float numFrames = 50; - -void setup() -{ - size(200, 200); - noStroke(); -} - -void draw() -{ - background(0); - x += random(-2, 2); - ellipse(x, 100, 80, 80); - if (frameCount <= numFrames) { - saveFrame("circles-####.tif"); - } -} diff --git a/java/examples/Topics/File IO/SavingFrames/SavingFrames.pde b/java/examples/Topics/File IO/SavingFrames/SavingFrames.pde index 70c81bce7..1f5c5ef06 100644 --- a/java/examples/Topics/File IO/SavingFrames/SavingFrames.pde +++ b/java/examples/Topics/File IO/SavingFrames/SavingFrames.pde @@ -3,7 +3,7 @@ * by Daniel Shiffman. * * This example demonstrates how to use saveFrame() to render - * our an image sequence that you can assemble into a movie + * out an image sequence that you can assemble into a movie * using the MovieMaker tool. */ @@ -50,8 +50,11 @@ void draw() { // A red dot for when we are recording stroke(255); - if (recording) fill(255, 0, 0); - else noFill(); + if (recording) { + fill(255, 0, 0); + } else { + noFill(); + } ellipse(width/2, height-48, 16, 16); } diff --git a/java/examples/Topics/File IO/TileImages/TileImages.pde b/java/examples/Topics/File IO/TileImages/TileImages.pde index 7b266570c..00af7c634 100644 --- a/java/examples/Topics/File IO/TileImages/TileImages.pde +++ b/java/examples/Topics/File IO/TileImages/TileImages.pde @@ -9,14 +9,12 @@ int scaleValue = 3; // Multiplication factor int xoffset = 0; // x-axis offset int yoffset = 0; // y-axis offset -void setup() -{ +void setup() { size(600, 600); stroke(0, 100); } -void draw() -{ +void draw() { scale(scaleValue); translate(xoffset *(-width / scaleValue), yoffset *(-height / scaleValue)); line(10, 150, 500, 50); @@ -24,9 +22,8 @@ void draw() setOffset(); } -void setOffset() -{ - save("lines-" + xoffset + "-" + yoffset + ".jpg"); +void setOffset() { + save("lines-" + xoffset + "-" + yoffset + ".png"); xoffset++; if (xoffset == scaleValue) { xoffset = 0; diff --git a/java/examples/Topics/File IO/SaveOneImage/SaveOneImage.pde b/java/examples/Topics/File IO/saveOneFrame/SaveOneImage.pde similarity index 87% rename from java/examples/Topics/File IO/SaveOneImage/SaveOneImage.pde rename to java/examples/Topics/File IO/saveOneFrame/SaveOneImage.pde index 81f5aa8e9..8487ab524 100644 --- a/java/examples/Topics/File IO/SaveOneImage/SaveOneImage.pde +++ b/java/examples/Topics/File IO/saveOneFrame/SaveOneImage.pde @@ -7,19 +7,16 @@ * same folder as the sketch's program file. */ -void setup() -{ +void setup() { size(200, 200); } -void draw() -{ +void draw() { background(204); line(0, 0, mouseX, height); line(width, 0, 0, mouseY); } -void mousePressed() -{ +void mousePressed() { save("line.tif"); }