#version 330 core
in vec2 vUV;
out vec4 FragColor;

uniform float uTime;
uniform float uSpeed;
uniform float uScale;
uniform float uWarp;
uniform float uAlpha;
uniform float uColorCycleSpeed;
uniform vec3 uColorA;
uniform vec3 uColorB;
uniform vec3 uColorC;

void main()
{
    vec2 uv = vUV * 2.0 - 1.0;
    float t = uTime * uSpeed;
    float v = 0.0;
    v += sin((uv.x * uScale) + t);
    v += sin((uv.y * uScale) + t * 1.37);
    v += sin((uv.x + uv.y) * uScale * 0.7 + t * 0.73);
    float r = length(uv);
    v += sin((r * uScale * (1.2 + uWarp)) - t * 1.11);
    v = v * 0.25 + 0.5;
    float c = 0.5 + 0.5 * sin(v * 6.28318 + t * uColorCycleSpeed);
    vec3 col = mix(uColorA, uColorB, v);
    col = mix(col, uColorC, c * 0.6);
    FragColor = vec4(col, uAlpha);
}
