Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
class Point {
PVector _pos;
float _size;
Point(PVector pos, float size) {
_pos = pos;
_size = size;
}
PVector GetPosition() {
return _pos;
}
void show() {
translate(0, 0, _pos.z);
rect(_pos.x, _pos.y, _size, _size);
translate(0, 0, -_pos.z);
}
}
Point[] points;
void setup() {
size(1280, 1280, OPENGL);
float xStart = 2.56;
float xNoise;
float yNoise = 5.5;
float size = 1;
float noizeSpeed = 0.0015;
points = new Point[height * width];
for (int y = 0; y < height; y++) {
yNoise += noizeSpeed;
xNoise = xStart;
for (int x = 0; x < width; x++) {
xNoise += noizeSpeed;
float z = noise(xNoise, yNoise) * 255;
points[height * y + x] = new Point(
new PVector(x * size, y * size, z * 3),
size
);
}
}
}
float alpha = 570;
void draw() {
background(255);
translate(0, 200, -width);
rotateX(radians(45));
for (int i = 0; i < points.length; i++) {
float z = points[i].GetPosition().z;
if (abs(alpha - z) < 0.8) {
stroke(0, 0, 255);
fill(0, 0, 255);
} else {
float b = z / 3;
stroke(b, b, b, 10);
fill(b, b, b, 10);
}
points[i].show();
}
fill(0, 0, 255, 50);
translate(0, 0, alpha);
rect(0, 0, width, height);
alpha -= 5;
// saveFrame("#####.png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment