Created
January 20, 2021 03:02
-
-
Save yearofthewhopper/86bcd4a3be3e987381895a512ceb9842 to your computer and use it in GitHub Desktop.
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
using namespace std; | |
// @param[default=#00EFFFF0] progressColor | |
// @param[default=#FF2FFFF0] timeSpentColor | |
// @param[default=5.0,min=0.0,max=60.0] Duration | |
void mainImage(vec4 progressColor, vec4 timeSpentColor,float Duration,out vec4 fragColor ) | |
{ | |
float Time = getTime(); | |
vec2 Resolution = getRenderTargetSize(); | |
vec2 fragCoord = fragment(getVertexTexCoord()) * Resolution; | |
float dur = Duration; | |
float progress = fract(Time / dur); | |
float innerRadius = 80.0; | |
float outerRadius = 120.0; | |
float middleRadius = 0.5 * (innerRadius + outerRadius); | |
float halfWidth = 0.5 * (outerRadius - innerRadius); | |
vec2 pos = fragCoord.xy - 0.5 * Resolution.xy; | |
float radius = length(pos.xy); | |
float fr = halfWidth - abs(radius - middleRadius) + 1.0; | |
if(fr < 0.0) discard; | |
fr = clamp(fr, 0.0, 1.0); | |
float angle = degrees(atan(-pos.x, pos.y)) + 180.0; | |
float fa = radians(angle - progress * 360.0) * radius + 1.0; | |
fa = clamp(fa, 0.0, 1.0); | |
vec4 color = vec4(0.8,0.9,1,1); | |
vec4 col = mix(progressColor, timeSpentColor, fa); | |
col.a *= fr; | |
vec4 bgColor = progressColor; | |
col = mix(bgColor, col, col.a); | |
fragColor = col; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment