uniform vec2 iResolution;
uniform float iTime;

uniform sampler2D gm_BaseTexture;

uniform bool gm_PS_FogEnabled;
uniform vec4 gm_FogColour;
uniform bool gm_AlphaTestEnabled;
uniform float gm_AlphaRefValue;

void DoAlphaTest(vec4 SrcColour)
{
	if (gm_AlphaTestEnabled)
	{
		if (SrcColour.a <= gm_AlphaRefValue)
		{
			discard;
		}
	}
}

void DoFog(inout vec4 SrcColour, float fogval)
{
	if (gm_PS_FogEnabled)
	{
		SrcColour = mix(SrcColour, gm_FogColour, clamp(fogval, 0.0, 1.0)); 
	}
}
#define _YY_GLSL_ 1

varying vec2 fragCoord; 
void main()
{
    vec2 fragCoord = openfl_TextureCoordv * iResolution;
    vec2 uv = fragCoord/iResolution.xy;
    
    float th = 1.0/3.0;
    float speed = iTime/2.0;
    uv.x *= 0.5 - 0.6*cos(uv.y*5.0 + speed) + 0.15*sin(uv.y*7.9 - speed*0.8) - 0.9*sin(uv.x*3.0 + speed*0.1);
    uv.x *= 0.9*cos(uv.y*3.0 + speed*0.1) + 1.0;
    
    uv.x *= 0.5 - 0.6*sin(uv.x*1.0 + speed*0.1 + 3.0) - 0.6*cos(uv.y*1.0 + speed*0.1 + 3.0);
       
    uv *= 7.0;
    uv = fract(uv);
    
    
    vec3 yellow = vec3(1.0, 0.8745, 0.3608);
    vec3 orange = vec3(1.0, 0.6706, 0.4863);
    vec3 pink   = vec3(1.0, 0.4784, 0.6824);  
    
    
    float r1 = 1.0 - step(th, uv.x);
    float r2 = 1.0 - step(th*2.0, uv.x) - r1;
    float r3 = 1.0 - step(th*3.0, uv.x) - r1 - r2;
    
    yellow *= r1;
    orange *= r2;
    pink   *= r3;
    vec3 col = vec3(yellow + orange + pink);
    gl_FragColor = vec4(col, 1.0);
}