removing applet folders from svn
@@ -1,62 +0,0 @@
|
||||
import processing.core.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class Coordinates extends PApplet {
|
||||
public void setup() {/**
|
||||
* Coordinates.
|
||||
*
|
||||
* All shapes drawn to the screen have a position that is specified as a coordinate.
|
||||
* All coordinates are measured as the distance from the origin in units of pixels.
|
||||
* The origin [0, 0] is the coordinate is in the upper left of the window
|
||||
* and the coordinate in the lower right is [width-1, height-1].
|
||||
*/
|
||||
|
||||
// Sets the screen to be 200, 200, so the width of the window is 200 pixels
|
||||
// and the height of the window is 200 pixels
|
||||
size(200, 200);
|
||||
background(0);
|
||||
noFill();
|
||||
stroke(255);
|
||||
|
||||
// The two parameters of the point() method each specify coordinates.
|
||||
// This call to point() draws at the position [100, 100]
|
||||
point(width/2, height/2);
|
||||
|
||||
// Draws to the position [100, 50]
|
||||
point(width/2, height/4);
|
||||
|
||||
// It is also possible to specify a point with any parameter,
|
||||
// but only coordinates on the screen are visible
|
||||
point(60, 30);
|
||||
point(60, 134);
|
||||
point(160, 50);
|
||||
point(280, -800);
|
||||
point(201, 100);
|
||||
|
||||
// Coordinates are used for drawing all shapes, not just points.
|
||||
// Parameters for different methods are used for different purposes.
|
||||
// For example, the first two parameters to line() specify the coordinates of the
|
||||
// first point and the second two parameters specify the second point
|
||||
stroke(204);
|
||||
line(0, 73, width, 73);
|
||||
|
||||
// The first two parameters to rect() are coordinates
|
||||
// and the second two are the width and height
|
||||
rect(110, 55, 40, 36);
|
||||
|
||||
noLoop();
|
||||
}
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "Coordinates" });
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* Coordinates.
|
||||
*
|
||||
* All shapes drawn to the screen have a position that is specified as a coordinate.
|
||||
* All coordinates are measured as the distance from the origin in units of pixels.
|
||||
* The origin [0, 0] is the coordinate is in the upper left of the window
|
||||
* and the coordinate in the lower right is [width-1, height-1].
|
||||
*/
|
||||
|
||||
// Sets the screen to be 200, 200, so the width of the window is 200 pixels
|
||||
// and the height of the window is 200 pixels
|
||||
size(200, 200);
|
||||
background(0);
|
||||
noFill();
|
||||
stroke(255);
|
||||
|
||||
// The two parameters of the point() method each specify coordinates.
|
||||
// This call to point() draws at the position [100, 100]
|
||||
point(width/2, height/2);
|
||||
|
||||
// Draws to the position [100, 50]
|
||||
point(width/2, height/4);
|
||||
|
||||
// It is also possible to specify a point with any parameter,
|
||||
// but only coordinates on the screen are visible
|
||||
point(60, 30);
|
||||
point(60, 134);
|
||||
point(160, 50);
|
||||
point(280, -800);
|
||||
point(201, 100);
|
||||
|
||||
// Coordinates are used for drawing all shapes, not just points.
|
||||
// Parameters for different methods are used for different purposes.
|
||||
// For example, the first two parameters to line() specify the coordinates of the
|
||||
// first point and the second two parameters specify the second point
|
||||
stroke(204);
|
||||
line(0, 73, width, 73);
|
||||
|
||||
// The first two parameters to rect() are coordinates
|
||||
// and the second two are the width and height
|
||||
rect(110, 55, 40, 36);
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,53 +0,0 @@
|
||||
import processing.core.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class CreateGraphics extends PApplet {
|
||||
|
||||
/**
|
||||
* Create Graphics.
|
||||
*
|
||||
* The createGraphics() function creates an object from the PGraphics class
|
||||
* (PGraphics is the main graphics and rendering context for Processing).
|
||||
* The beginDraw() method is necessary to prepare for drawing and endDraw() is
|
||||
* necessary to finish. Use this class if you need to draw into an off-screen
|
||||
* graphics buffer or to maintain two contexts with different properties.
|
||||
*/
|
||||
|
||||
PGraphics pg;
|
||||
|
||||
public void setup() {
|
||||
size(200, 200);
|
||||
pg = createGraphics(80, 80, P3D);
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
fill(0, 12);
|
||||
rect(0, 0, width, height);
|
||||
fill(255);
|
||||
noStroke();
|
||||
ellipse(mouseX, mouseY, 60, 60);
|
||||
|
||||
pg.beginDraw();
|
||||
pg.background(102);
|
||||
pg.noFill();
|
||||
pg.stroke(255);
|
||||
pg.ellipse(mouseX-60, mouseY-60, 60, 60);
|
||||
pg.endDraw();
|
||||
|
||||
image(pg, 60, 60);
|
||||
}
|
||||
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "CreateGraphics" });
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* Create Graphics.
|
||||
*
|
||||
* The createGraphics() function creates an object from the PGraphics class
|
||||
* (PGraphics is the main graphics and rendering context for Processing).
|
||||
* The beginDraw() method is necessary to prepare for drawing and endDraw() is
|
||||
* necessary to finish. Use this class if you need to draw into an off-screen
|
||||
* graphics buffer or to maintain two contexts with different properties.
|
||||
*/
|
||||
|
||||
PGraphics pg;
|
||||
|
||||
void setup() {
|
||||
size(200, 200);
|
||||
pg = createGraphics(80, 80, P3D);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
fill(0, 12);
|
||||
rect(0, 0, width, height);
|
||||
fill(255);
|
||||
noStroke();
|
||||
ellipse(mouseX, mouseY, 60, 60);
|
||||
|
||||
pg.beginDraw();
|
||||
pg.background(102);
|
||||
pg.noFill();
|
||||
pg.stroke(255);
|
||||
pg.ellipse(mouseX-60, mouseY-60, 60, 60);
|
||||
pg.endDraw();
|
||||
|
||||
image(pg, 60, 60);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,53 +0,0 @@
|
||||
import processing.core.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class Functions extends PApplet {
|
||||
|
||||
/**
|
||||
* Functions.
|
||||
*
|
||||
* The drawTarget() function makes it easy to draw many distinct targets.
|
||||
* Each call to drawTarget() specifies the position, size, and number of
|
||||
* rings for each target.
|
||||
*/
|
||||
|
||||
public void setup()
|
||||
{
|
||||
size(200, 200);
|
||||
background(51);
|
||||
noStroke();
|
||||
smooth();
|
||||
noLoop();
|
||||
}
|
||||
|
||||
public void draw()
|
||||
{
|
||||
drawTarget(68, 34, 200, 10);
|
||||
drawTarget(152, 16, 100, 3);
|
||||
drawTarget(100, 144, 80, 5);
|
||||
}
|
||||
|
||||
public void drawTarget(int xloc, int yloc, int size, int num)
|
||||
{
|
||||
float grayvalues = 255/num;
|
||||
float steps = size/num;
|
||||
for(int i=0; i<num; i++) {
|
||||
fill(i*grayvalues);
|
||||
ellipse(xloc, yloc, size-i*steps, size-i*steps);
|
||||
}
|
||||
}
|
||||
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "Functions" });
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* Functions.
|
||||
*
|
||||
* The drawTarget() function makes it easy to draw many distinct targets.
|
||||
* Each call to drawTarget() specifies the position, size, and number of
|
||||
* rings for each target.
|
||||
*/
|
||||
|
||||
void setup()
|
||||
{
|
||||
size(200, 200);
|
||||
background(51);
|
||||
noStroke();
|
||||
smooth();
|
||||
noLoop();
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
drawTarget(68, 34, 200, 10);
|
||||
drawTarget(152, 16, 100, 3);
|
||||
drawTarget(100, 144, 80, 5);
|
||||
}
|
||||
|
||||
void drawTarget(int xloc, int yloc, int size, int num)
|
||||
{
|
||||
float grayvalues = 255/num;
|
||||
float steps = size/num;
|
||||
for(int i=0; i<num; i++) {
|
||||
fill(i*grayvalues);
|
||||
ellipse(xloc, yloc, size-i*steps, size-i*steps);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,60 +0,0 @@
|
||||
import processing.core.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class Loop extends PApplet {
|
||||
|
||||
/**
|
||||
* Loop.
|
||||
*
|
||||
* The loop() function causes draw() to execute
|
||||
* continuously. If noLoop is called in setup()
|
||||
* the draw() is only executed once. In this example
|
||||
* click the mouse to execute loop(), which will
|
||||
* cause the draw() the execute continuously.
|
||||
*/
|
||||
|
||||
// The statements in the setup() function
|
||||
// execute once when the program begins
|
||||
public void setup()
|
||||
{
|
||||
size(200, 200); // Size should be the first statement
|
||||
stroke(255); // Set stroke color to white
|
||||
noLoop();
|
||||
}
|
||||
|
||||
float y = 100;
|
||||
|
||||
// The statements in draw() are run until the
|
||||
// program is stopped. Each statement is run in
|
||||
// sequence and after the last line is read, the first
|
||||
// line is run again.
|
||||
public void draw()
|
||||
{
|
||||
background(0); // Set the background to black
|
||||
line(0, y, width, y);
|
||||
|
||||
y = y - 1;
|
||||
if (y < 0) {
|
||||
y = height;
|
||||
}
|
||||
}
|
||||
|
||||
public void mousePressed()
|
||||
{
|
||||
loop();
|
||||
}
|
||||
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "Loop" });
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* Loop.
|
||||
*
|
||||
* The loop() function causes draw() to execute
|
||||
* continuously. If noLoop is called in setup()
|
||||
* the draw() is only executed once. In this example
|
||||
* click the mouse to execute loop(), which will
|
||||
* cause the draw() the execute continuously.
|
||||
*/
|
||||
|
||||
// The statements in the setup() function
|
||||
// execute once when the program begins
|
||||
void setup()
|
||||
{
|
||||
size(200, 200); // Size should be the first statement
|
||||
stroke(255); // Set stroke color to white
|
||||
noLoop();
|
||||
}
|
||||
|
||||
float y = 100;
|
||||
|
||||
// The statements in draw() are run until the
|
||||
// program is stopped. Each statement is run in
|
||||
// sequence and after the last line is read, the first
|
||||
// line is run again.
|
||||
void draw()
|
||||
{
|
||||
background(0); // Set the background to black
|
||||
line(0, y, width, y);
|
||||
|
||||
y = y - 1;
|
||||
if (y < 0) {
|
||||
y = height;
|
||||
}
|
||||
}
|
||||
|
||||
void mousePressed()
|
||||
{
|
||||
loop();
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,53 +0,0 @@
|
||||
import processing.core.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class NoLoop extends PApplet {
|
||||
|
||||
/**
|
||||
* No Loop.
|
||||
*
|
||||
* The noLoop() function causes draw() to only
|
||||
* execute once. Without calling noLoop(), draw()
|
||||
* executed continually.
|
||||
*/
|
||||
|
||||
// The statements in the setup() function
|
||||
// execute once when the program begins
|
||||
public void setup()
|
||||
{
|
||||
size(200, 200); // Size should be the first statement
|
||||
stroke(255); // Set line drawing color to white
|
||||
frameRate(30);
|
||||
noLoop();
|
||||
}
|
||||
|
||||
float y = 100;
|
||||
|
||||
// The statements in draw() are executed until the
|
||||
// program is stopped. Each statement is executed in
|
||||
// sequence and after the last line is read, the first
|
||||
// line is executed again.
|
||||
public void draw()
|
||||
{
|
||||
background(0); // Set the background to black
|
||||
y = y - 1;
|
||||
if (y < 0) { y = height; }
|
||||
line(0, y, width, y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "NoLoop" });
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* No Loop.
|
||||
*
|
||||
* The noLoop() function causes draw() to only
|
||||
* execute once. Without calling noLoop(), draw()
|
||||
* executed continually.
|
||||
*/
|
||||
|
||||
// The statements in the setup() function
|
||||
// execute once when the program begins
|
||||
void setup()
|
||||
{
|
||||
size(200, 200); // Size should be the first statement
|
||||
stroke(255); // Set line drawing color to white
|
||||
frameRate(30);
|
||||
noLoop();
|
||||
}
|
||||
|
||||
float y = 100;
|
||||
|
||||
// The statements in draw() are executed until the
|
||||
// program is stopped. Each statement is executed in
|
||||
// sequence and after the last line is read, the first
|
||||
// line is executed again.
|
||||
void draw()
|
||||
{
|
||||
background(0); // Set the background to black
|
||||
y = y - 1;
|
||||
if (y < 0) { y = height; }
|
||||
line(0, y, width, y);
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,52 +0,0 @@
|
||||
import processing.core.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class Recursion extends PApplet {
|
||||
|
||||
/**
|
||||
* Recursion.
|
||||
*
|
||||
* A demonstration of recursion, which means functions call themselves.
|
||||
* Notice how the drawCircle() function calls itself at the end of its block.
|
||||
* It continues to do this until the variable "level" is equal to 1.
|
||||
*/
|
||||
|
||||
public void setup()
|
||||
{
|
||||
size(200, 200);
|
||||
noStroke();
|
||||
smooth();
|
||||
noLoop();
|
||||
}
|
||||
|
||||
public void draw()
|
||||
{
|
||||
drawCircle(126, 170, 6);
|
||||
}
|
||||
|
||||
public void drawCircle(int x, int radius, int level)
|
||||
{
|
||||
float tt = 126 * level/4.0f;
|
||||
fill(tt);
|
||||
ellipse(x, 100, radius*2, radius*2);
|
||||
if(level > 1) {
|
||||
level = level - 1;
|
||||
drawCircle(x - radius/2, radius/2, level);
|
||||
drawCircle(x + radius/2, radius/2, level);
|
||||
}
|
||||
}
|
||||
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "Recursion" });
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* Recursion.
|
||||
*
|
||||
* A demonstration of recursion, which means functions call themselves.
|
||||
* Notice how the drawCircle() function calls itself at the end of its block.
|
||||
* It continues to do this until the variable "level" is equal to 1.
|
||||
*/
|
||||
|
||||
void setup()
|
||||
{
|
||||
size(200, 200);
|
||||
noStroke();
|
||||
smooth();
|
||||
noLoop();
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
drawCircle(126, 170, 6);
|
||||
}
|
||||
|
||||
void drawCircle(int x, int radius, int level)
|
||||
{
|
||||
float tt = 126 * level/4.0;
|
||||
fill(tt);
|
||||
ellipse(x, 100, radius*2, radius*2);
|
||||
if(level > 1) {
|
||||
level = level - 1;
|
||||
drawCircle(x - radius/2, radius/2, level);
|
||||
drawCircle(x + radius/2, radius/2, level);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,52 +0,0 @@
|
||||
import processing.core.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class Recursion2 extends PApplet {
|
||||
|
||||
/**
|
||||
* Recursion.
|
||||
*
|
||||
* A demonstration of recursion, which means functions call themselves.
|
||||
* Notice how the drawCircle() function calls itself at the end of its block.
|
||||
* It continues to do this until the variable "level" is equal to 1.
|
||||
*/
|
||||
|
||||
public void setup()
|
||||
{
|
||||
size(200, 200);
|
||||
noStroke();
|
||||
smooth();
|
||||
drawCircle(100, 100, 80, 8);
|
||||
}
|
||||
|
||||
public void drawCircle(float x, float y, int radius, int level)
|
||||
{
|
||||
float tt = 126 * level/6.0f;
|
||||
fill(tt, 153);
|
||||
ellipse(x, y, radius*2, radius*2);
|
||||
if(level > 1) {
|
||||
level = level - 1;
|
||||
int num = PApplet.parseInt(random(2, 6));
|
||||
for(int i=0; i<num; i++) {
|
||||
float a = random(0, TWO_PI);
|
||||
float nx = x + cos(a) * 6.0f * level;
|
||||
float ny = y + sin(a) * 6.0f * level;
|
||||
drawCircle(nx, ny, radius/2, level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "Recursion2" });
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* Recursion.
|
||||
*
|
||||
* A demonstration of recursion, which means functions call themselves.
|
||||
* Notice how the drawCircle() function calls itself at the end of its block.
|
||||
* It continues to do this until the variable "level" is equal to 1.
|
||||
*/
|
||||
|
||||
void setup()
|
||||
{
|
||||
size(200, 200);
|
||||
noStroke();
|
||||
smooth();
|
||||
drawCircle(100, 100, 80, 8);
|
||||
}
|
||||
|
||||
void drawCircle(float x, float y, int radius, int level)
|
||||
{
|
||||
float tt = 126 * level/6.0;
|
||||
fill(tt, 153);
|
||||
ellipse(x, y, radius*2, radius*2);
|
||||
if(level > 1) {
|
||||
level = level - 1;
|
||||
int num = int(random(2, 6));
|
||||
for(int i=0; i<num; i++) {
|
||||
float a = random(0, TWO_PI);
|
||||
float nx = x + cos(a) * 6.0 * level;
|
||||
float ny = y + sin(a) * 6.0 * level;
|
||||
drawCircle(nx, ny, radius/2, level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,57 +0,0 @@
|
||||
import processing.core.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class Redraw extends PApplet {
|
||||
|
||||
/**
|
||||
* Redraw.
|
||||
*
|
||||
* The redraw() function makes draw() execute once.
|
||||
* In this example, draw() is executed once every time
|
||||
* the mouse is clicked.
|
||||
*/
|
||||
|
||||
// The statements in the setup() function
|
||||
// execute once when the program begins
|
||||
public void setup()
|
||||
{
|
||||
size(200, 200); // Size should be the first statement
|
||||
stroke(255); // Set line drawing color to white
|
||||
noLoop();
|
||||
}
|
||||
|
||||
float y = 100;
|
||||
|
||||
// The statements in draw() are executed until the
|
||||
// program is stopped. Each statement is executed in
|
||||
// sequence and after the last line is read, the first
|
||||
// line is executed again.
|
||||
public void draw()
|
||||
{
|
||||
background(0); // Set the background to black
|
||||
y = y - 1;
|
||||
if (y < 0) { y = height; }
|
||||
line(0, y, width, y);
|
||||
}
|
||||
|
||||
public void mousePressed()
|
||||
{
|
||||
redraw();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "Redraw" });
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/**
|
||||
* Redraw.
|
||||
*
|
||||
* The redraw() function makes draw() execute once.
|
||||
* In this example, draw() is executed once every time
|
||||
* the mouse is clicked.
|
||||
*/
|
||||
|
||||
// The statements in the setup() function
|
||||
// execute once when the program begins
|
||||
void setup()
|
||||
{
|
||||
size(200, 200); // Size should be the first statement
|
||||
stroke(255); // Set line drawing color to white
|
||||
noLoop();
|
||||
}
|
||||
|
||||
float y = 100;
|
||||
|
||||
// The statements in draw() are executed until the
|
||||
// program is stopped. Each statement is executed in
|
||||
// sequence and after the last line is read, the first
|
||||
// line is executed again.
|
||||
void draw()
|
||||
{
|
||||
background(0); // Set the background to black
|
||||
y = y - 1;
|
||||
if (y < 0) { y = height; }
|
||||
line(0, y, width, y);
|
||||
}
|
||||
|
||||
void mousePressed()
|
||||
{
|
||||
redraw();
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,50 +0,0 @@
|
||||
import processing.core.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class SetupDraw extends PApplet {
|
||||
|
||||
/**
|
||||
* Setup and Draw.
|
||||
*
|
||||
* The draw() function creates a structure in which
|
||||
* to write programs that change with time.
|
||||
*/
|
||||
|
||||
// The statements in the setup() function
|
||||
// execute once when the program begins
|
||||
public void setup()
|
||||
{
|
||||
size(200, 200); // Size should be the first statement
|
||||
stroke(255); // Set line drawing color to white
|
||||
frameRate(30);
|
||||
}
|
||||
|
||||
float y = 100;
|
||||
|
||||
// The statements in draw() are executed until the
|
||||
// program is stopped. Each statement is executed in
|
||||
// sequence and after the last line is read, the first
|
||||
// line is executed again.
|
||||
public void draw()
|
||||
{
|
||||
background(0); // Set the background to black
|
||||
y = y - 1;
|
||||
if (y < 0) { y = height; }
|
||||
line(0, y, width, y);
|
||||
}
|
||||
|
||||
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "SetupDraw" });
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* Setup and Draw.
|
||||
*
|
||||
* The draw() function creates a structure in which
|
||||
* to write programs that change with time.
|
||||
*/
|
||||
|
||||
// The statements in the setup() function
|
||||
// execute once when the program begins
|
||||
void setup()
|
||||
{
|
||||
size(200, 200); // Size should be the first statement
|
||||
stroke(255); // Set line drawing color to white
|
||||
frameRate(30);
|
||||
}
|
||||
|
||||
float y = 100;
|
||||
|
||||
// The statements in draw() are executed until the
|
||||
// program is stopped. Each statement is executed in
|
||||
// sequence and after the last line is read, the first
|
||||
// line is executed again.
|
||||
void draw()
|
||||
{
|
||||
background(0); // Set the background to black
|
||||
y = y - 1;
|
||||
if (y < 0) { y = height; }
|
||||
line(0, y, width, y);
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,41 +0,0 @@
|
||||
import processing.core.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class StatementsComments extends PApplet {
|
||||
public void setup() {/**
|
||||
* Statements and Comments.
|
||||
*
|
||||
* Statements are the elements that make up programs.
|
||||
* The ";" (semi-colon) symbol is used to end statements.
|
||||
* It is called the "statement terminator."
|
||||
* Comments are used for making notes to help people better understand programs.
|
||||
* A comment begins with two forward slashes ("//").
|
||||
*/
|
||||
|
||||
// The size function is a statement that tells the computer
|
||||
// how large to make the window.
|
||||
// Each function statement has zero or more parameters.
|
||||
// Parameters are data passed into the function
|
||||
// and used as values for specifying what the computer will do.
|
||||
size(200, 200);
|
||||
|
||||
// The background function is a statement that tells the computer
|
||||
// which color to make the background of the window
|
||||
background(102);
|
||||
|
||||
noLoop();
|
||||
}
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "StatementsComments" });
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Statements and Comments.
|
||||
*
|
||||
* Statements are the elements that make up programs.
|
||||
* The ";" (semi-colon) symbol is used to end statements.
|
||||
* It is called the "statement terminator."
|
||||
* Comments are used for making notes to help people better understand programs.
|
||||
* A comment begins with two forward slashes ("//").
|
||||
*/
|
||||
|
||||
// The size function is a statement that tells the computer
|
||||
// how large to make the window.
|
||||
// Each function statement has zero or more parameters.
|
||||
// Parameters are data passed into the function
|
||||
// and used as values for specifying what the computer will do.
|
||||
size(200, 200);
|
||||
|
||||
// The background function is a statement that tells the computer
|
||||
// which color to make the background of the window
|
||||
background(102);
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,37 +0,0 @@
|
||||
import processing.core.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class WidthHeight extends PApplet {
|
||||
public void setup() {/**
|
||||
* Width and Height.
|
||||
*
|
||||
* The 'width' and 'height' variables contain the width and height
|
||||
* of the display window as defined in the size() function.
|
||||
*/
|
||||
|
||||
size(200, 200);
|
||||
background(127);
|
||||
noStroke();
|
||||
for(int i=0; i<height; i+=20) {
|
||||
fill(0);
|
||||
rect(0, i, width, 10);
|
||||
fill(255);
|
||||
rect(i, 0, 10, height);
|
||||
}
|
||||
|
||||
noLoop();
|
||||
}
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "WidthHeight" });
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* Width and Height.
|
||||
*
|
||||
* The 'width' and 'height' variables contain the width and height
|
||||
* of the display window as defined in the size() function.
|
||||
*/
|
||||
|
||||
size(200, 200);
|
||||
background(127);
|
||||
noStroke();
|
||||
for(int i=0; i<height; i+=20) {
|
||||
fill(0);
|
||||
rect(0, i, width, 10);
|
||||
fill(255);
|
||||
rect(i, 0, 10, height);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |