Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Swiggling hole
float dnoise = 0;
void setup() {
size(300, 300);
smooth();
frameRate(30);
}
void draw() {
background(0);
float ynoise = 0;
for (int y = 0; y < height; y += 5) {
ynoise += 0.01;
float xnoise = 0;
for (int x = 0; x < width; x += 5) {
xnoise += 0.01;
int tx = x - width / 2;
int ty = y - height / 2;
float d = sqrt(tx * tx + ty * ty) / width;
drawPoint(x, y, noise(xnoise, ynoise, dnoise + 20 * d * d), d + 0.01);
}
}
dnoise += 0.03;
}
void drawPoint(float x, float y, float noiseFactor, float alpha) {
pushMatrix();
translate(x, y);
rotate(noiseFactor * radians(360));
stroke(255, 0, 0, 255 * alpha);
line(0, 0, 20, 0);
popMatrix();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment