64 lines
1.8 KiB
Plaintext
64 lines
1.8 KiB
Plaintext
final float valueIncrement = 5;
|
|
float valueOffset = 0;
|
|
float maxValue;
|
|
|
|
// final float radiusIncrement = 1;
|
|
// float radiusOffset = 0, midMag;
|
|
// PVector middle;
|
|
|
|
// final float angleIncrement = HALF_PI/128;
|
|
// float angleOffset = 0;
|
|
|
|
void setup() {
|
|
fullScreen();
|
|
colorMode(HSB);
|
|
frameRate(360);
|
|
// textAlign(LEFT, TOP);
|
|
|
|
// middle = new PVector(width / 2, height / 2);
|
|
// midMag = middle.mag();
|
|
|
|
maxValue = ( (float)width + height - 2 );
|
|
}
|
|
|
|
void draw() {
|
|
loadPixels();
|
|
for (int x = 0; x < width; x++) {
|
|
for (int y = 0; y < height; y++) {
|
|
int index = x + y * width;
|
|
|
|
final float value = (x + y + valueOffset + maxValue) % maxValue;
|
|
final float hue = map(value, 0, maxValue, 0, 255);
|
|
|
|
// final float value = PVector.dist(new PVector(x, y), middle);
|
|
// final float shifted = (value + radiusOffset + midMag) % midMag;
|
|
// final float hue = map(shifted, 0, midMag, 0, 255);
|
|
|
|
pixels[index] = color(hue, 255, 255);
|
|
|
|
/*
|
|
final int nx = width / 2 - x;
|
|
final int ny = height / 2 - y;
|
|
if (nx == 0 && ny == 0)
|
|
pixels[index] = color(0, 0, 0);
|
|
else {
|
|
float value = (nx > 0) ? atan((float)ny / nx) : ((nx < 0) ? (atan((float)ny / nx) + PI) : HALF_PI);
|
|
value = (nx == 0 && ny < 0) ? 3*HALF_PI : value;
|
|
final float rotated = (value + HALF_PI + angleOffset + TWO_PI) % TWO_PI;
|
|
final float hue = map(rotated, 0, TWO_PI, 0, 255);
|
|
pixels[index] = color(hue, 255, 255);
|
|
}
|
|
*/
|
|
}
|
|
}
|
|
updatePixels();
|
|
|
|
valueOffset = (valueOffset + valueIncrement + maxValue) % maxValue;
|
|
// radiusOffset = (radiusOffset + radiusIncrement + midMag) % midMag;
|
|
// angleOffset = (angleOffset + angleIncrement + TWO_PI) % TWO_PI;
|
|
|
|
saveFrame("F:/Stash/ProcessingAnimations/Diagonal/frame-####.png");
|
|
|
|
// text(frameRate, 0, 0);
|
|
}
|