The Code Therapy

Burst of Light

Color gradients bursting from the center of the screen.

Created by xor_swap on Sun, 09 Apr 2023 10:18:17 GMT.


#version 300 es
precision mediump float;

uniform vec2 resolution;
uniform float time;
out vec4 fragColor;

vec3 fragment(vec2 uv) {
	vec3 c;
	float l, z = time;
	vec2 p = uv;
	for (int i = 0; i < 3; i++) {
		vec2 q = uv + 0.5;
		z += 0.7;
		l = length(p);
		q += p / l * (cos(z) / z * sin(time) + 1.0) * abs(sin(l * 3.0 - z));
		float w = sin(time / 2.0);
		c[i] = 0.2 / length(mod(q, 1.0)) * w * w;
	}
	return vec3(c / l);
}

void main(void) {
	vec2 uv = gl_FragCoord.xy / resolution.xy;
	uv -= 0.5;
	uv.x *= resolution.x / resolution.y;
	fragColor = vec4(fragment(uv), 1.0);
}