mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
removing applet folders from svn
This commit is contained in:
@@ -1,68 +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 Brownian extends PApplet {
|
||||
|
||||
/**
|
||||
* Brownian motion.
|
||||
*
|
||||
* Recording random movement as a continuous line.
|
||||
*/
|
||||
|
||||
int num = 2000;
|
||||
int range = 6;
|
||||
|
||||
float[] ax = new float[num];
|
||||
float[] ay = new float[num];
|
||||
|
||||
|
||||
public void setup()
|
||||
{
|
||||
size(640, 360);
|
||||
for(int i = 0; i < num; i++) {
|
||||
ax[i] = width/2;
|
||||
ay[i] = height/2;
|
||||
}
|
||||
frameRate(30);
|
||||
}
|
||||
|
||||
public void draw()
|
||||
{
|
||||
background(51);
|
||||
|
||||
// Shift all elements 1 place to the left
|
||||
for(int i = 1; i < num; i++) {
|
||||
ax[i-1] = ax[i];
|
||||
ay[i-1] = ay[i];
|
||||
}
|
||||
|
||||
// Put a new value at the end of the array
|
||||
ax[num-1] += random(-range, range);
|
||||
ay[num-1] += random(-range, range);
|
||||
|
||||
// Constrain all points to the screen
|
||||
ax[num-1] = constrain(ax[num-1], 0, width);
|
||||
ay[num-1] = constrain(ay[num-1], 0, height);
|
||||
|
||||
// Draw a line connecting the points
|
||||
for(int i=1; i<num; i++) {
|
||||
float val = PApplet.parseFloat(i)/num * 204.0f + 51;
|
||||
stroke(val);
|
||||
line(ax[i-1], ay[i-1], ax[i], ay[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "Brownian" });
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/**
|
||||
* Brownian motion.
|
||||
*
|
||||
* Recording random movement as a continuous line.
|
||||
*/
|
||||
|
||||
int num = 2000;
|
||||
int range = 6;
|
||||
|
||||
float[] ax = new float[num];
|
||||
float[] ay = new float[num];
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
size(640, 360);
|
||||
for(int i = 0; i < num; i++) {
|
||||
ax[i] = width/2;
|
||||
ay[i] = height/2;
|
||||
}
|
||||
frameRate(30);
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
background(51);
|
||||
|
||||
// Shift all elements 1 place to the left
|
||||
for(int i = 1; i < num; i++) {
|
||||
ax[i-1] = ax[i];
|
||||
ay[i-1] = ay[i];
|
||||
}
|
||||
|
||||
// Put a new value at the end of the array
|
||||
ax[num-1] += random(-range, range);
|
||||
ay[num-1] += random(-range, range);
|
||||
|
||||
// Constrain all points to the screen
|
||||
ax[num-1] = constrain(ax[num-1], 0, width);
|
||||
ay[num-1] = constrain(ay[num-1], 0, height);
|
||||
|
||||
// Draw a line connecting the points
|
||||
for(int i=1; i<num; i++) {
|
||||
float val = float(i)/num * 204.0 + 51;
|
||||
stroke(val);
|
||||
line(ax[i-1], ay[i-1], ax[i], ay[i]);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
Reference in New Issue
Block a user