Skip to content

Instantly share code, notes, and snippets.

@jacobjoaquin
Last active August 19, 2019 09:54
Show Gist options
  • Save jacobjoaquin/615a11ed2e8d2ff704a368e692d74ce0 to your computer and use it in GitHub Desktop.
Save jacobjoaquin/615a11ed2e8d2ff704a368e692d74ce0 to your computer and use it in GitHub Desktop.
Solar Flare - Built with Processing
/*
Solar Flare
Jacob Joaquin
Find me:
https://github.com/jacobjoaquin/
https://hackaday.io/jacobjoaquin
https://twitter.com/JacobJoaquin
http://jacobjoaquin.tumblr.com/
https://www.instagram.com/jacobjoaquin/
https://www.openprocessing.org/user/23998
*/
float xOffset = 100; // Perlin x-offset
float yOffset = -1000; // Perlin y-offset
float offsetInc = 0.002; // Perlin offset increment
float inc = 1; // Perin increment
float s = 4000; // Size of perlin ring
float m = 0.997; // Size multiplier
int nPoints = 500; // Resolution of perlin ring
int nSeed = 12; // Perlin noise seed
void settings() {
size(500, 500);
pixelDensity(displayDensity());
}
void setup() {
background(0);
blendMode(ADD);
noFill();
stroke(255, 64, 8, 128);
noiseSeed(nSeed);
translate(width * 0.8, height * 0.8);
// Create a series of perlin rings from big to small
while (s > 0.5) {
// Create ring
beginShape();
for (int i = 0; i < nPoints; i++) {
PVector p = PVector.fromAngle(i / (float) nPoints * TAU);
float n = noise(xOffset + p.x * inc, yOffset + p.y * inc) * s;
p.mult(n);
vertex(p.x, p.y);
}
endShape(CLOSE);
// Increment perlin offset for next ring
xOffset += offsetInc;
yOffset += offsetInc;
// Reduce size for next ring
s *= m;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment