Skip to content

Instantly share code, notes, and snippets.

@Rudxain
Last active July 12, 2025 14:16
Show Gist options
  • Save Rudxain/ff96b38c6a2b2f10446b13050ad8122c to your computer and use it in GitHub Desktop.
Save Rudxain/ff96b38c6a2b2f10446b13050ad8122c to your computer and use it in GitHub Desktop.
Assumed environment: `de.markusfisch.android.shadereditor`
#version 300 es
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform vec2 resolution;
uniform float time;
out vec4 fragColor;
float angle(const vec2 x, const vec2 y) {
vec2 offset = y - x;
return atan(offset.y, offset.x);
}
const vec2 CENTER = vec2(0.5, 1.25);
const float PEAKS = 5.0;
void main() {
float m = min(resolution.x, resolution.y);
vec2 uv = gl_FragCoord.xy / m;
float shape = sin(
// rotation
sin(time) * PEAKS * 2.0 +
angle(uv, CENTER) * PEAKS
) / 4.0
// polarity inverter
* sin(time * 2.0) / 4.0;
// size bounce
float radius = (sin(time * 1.25) + 4.0) / 16.0;
vec3 col = vec3(0.5,0.8,1);
// no anti-alias
if (distance(uv, CENTER) + shape < radius) {
col = vec3(1.0, 1.0, 0);
}
fragColor = vec4(col, 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment