test for example moving

This commit is contained in:
benfry
2012-04-08 15:45:29 +00:00
parent 7c5ea232f4
commit ce09fda5ea
@@ -0,0 +1,17 @@
int res = 16; // Number of data elements
float[] x = new float[res]; // Create x-coordinate array
float[] y = new float[res]; // Create y-coordinate array
void setup() {
size(100, 100);
for (int i = 0; i < res; i++) {
x[i] = cos(PI/res * i); // Sets x-coordinates
y[i] = sin(PI/res * i); // Sets y-coordinates
}
}
void draw() {
for (int i = 0; i < res; i++) { // Access each point
point(50 + x[i]*40, 50 + y[i]*40); // Draws point on a curve
}
}