Created
July 25, 2017 22:54
-
-
Save RyanScottLewis/e2dbafda87b3b7517629bab15e98d6cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int points = 1000; | |
float xOffset = 0; | |
float yOffset = -1000; | |
float offsetStepIncrement = 0.01; | |
float offsetFrameIncrement = 0.002; | |
float size = 7000; | |
float sizeMultiplier = 0.99; | |
float noiseIncrement = 2; | |
float hue = 0; | |
float hueIncrement = 0.001; | |
float minSize = 10; | |
int picNum = 0; | |
void setup() { | |
// size(800, 800, P3D); | |
fullScreen(P3D); | |
pixelDensity(displayDensity()); | |
smooth(8); | |
strokeJoin(ROUND); | |
blendMode(ADD); | |
noFill(); | |
colorMode(HSB, 1.0); | |
} | |
void draw() { | |
drawPerlin(); | |
saveImage(); | |
} | |
void drawPerlin() { | |
background(0); | |
stroke(hue, 0.5, 0.5, 128); | |
translate(width / 2, height / 2); | |
float scale = size; | |
float xOffsetInitial = xOffset; | |
float yOffsetInitial = yOffset; | |
while (scale > minSize) { | |
beginShape(); | |
for (int point = 0; point < points; point++) { | |
PVector position = PVector.fromAngle(point / (float) points * TAU); | |
float perlinNoise = noise(xOffset + position.x * noiseIncrement, yOffset + position.y * noiseIncrement) * scale; | |
position.mult(perlinNoise); | |
vertex(position.x, position.y); | |
} | |
endShape(CLOSE); | |
xOffset += offsetStepIncrement; | |
yOffset += offsetStepIncrement; | |
scale *= sizeMultiplier; | |
} | |
xOffset = xOffsetInitial; | |
yOffset = yOffsetInitial; | |
xOffset += offsetFrameIncrement; | |
yOffset += offsetFrameIncrement; | |
hue += hueIncrement; | |
hue %= 1.0; | |
} | |
void saveImage() { | |
save("../images/" + picNum + ".png"); | |
picNum++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment