-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniel
authored
Nov 7, 2016
1 parent
eef2c25
commit 0f2e2ef
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include <math_constants> | ||
#include <multisample> | ||
#include <perlin> | ||
|
||
parameter float timeScale = 30.0 : range(10.0, 50.0); | ||
parameter float stripeSize = 60.0 : range(1.0, 100.0); | ||
parameter int numSpirals = 1 : range(1, 20); | ||
parameter bool invert = false; | ||
|
||
glsl vec4 drawSpiral(vec2 pos) { | ||
vec2 origin = shadron_Dimensions / 2; | ||
vec2 loc = pos * shadron_Dimensions; | ||
vec2 normalized = normalize(loc - origin); | ||
float distFromOrigin = distance(loc, origin); | ||
|
||
vec3 color1 = vec3(0.42, 0.18, 0.45); | ||
vec3 color2 = vec3(1.0); | ||
|
||
// Animation and spiraling | ||
float animationTime = shadron_Time * timeScale; | ||
float angularComponent = (atan(normalized.x, normalized.y) / PI) * (stripeSize * numSpirals); | ||
|
||
// Wavy edges | ||
// float numRotations = distFromOrigin - mod(distFromOrigin, stripeSize); | ||
// float noiseComponent = perlinNoise(vec2(angularComponent * 0.03 * distFromOrigin / stripeSize, 0.0)) * stripeSize / 10; | ||
|
||
// Stipes | ||
float stripe = mod(distFromOrigin - animationTime + angularComponent, (stripeSize * 2)); | ||
bool ringType = (stripe - stripeSize) >= 0; | ||
|
||
vec3 thisColor = ringType ? color1 : mix(color2, vec3(0.0), stripe / (stripeSize * 2)); | ||
|
||
if (invert) { | ||
thisColor = 1.0 - thisColor; | ||
} | ||
|
||
return vec4(thisColor, 1.0); | ||
} | ||
|
||
animation Spiral = glsl(multisample<drawSpiral, 4>, 1600, 900); | ||
// export png_sequence(Spiral, "spiral_?.png", 50, 4); |
0f2e2ef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good