#version 120
uniform float time;
uniform vec2 resolution;


// Basic Fractal Zero by @paulofalcao
// Source: https://www.shadertoy.com/view/tltSWs


const int maxIterations=4;

//generic rotation formula
mat2 rot(float a)
{
    float c=cos(a);float s=sin(a);
    return mat2(c,-s,s,c);
}

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
	//normalize stuff
  vec2 R=resolution.xy,uv=(fragCoord-0.5*R)/R.x;
    
	//global zoom
	uv*=sin(time)*0.5+1.5;
    
	//shift, mirror, rotate and scale 6 times...
	for(int i=0;i<maxIterations;i++)
  {
    //uv*=2.1;          //<-Scale
    uv*=2.10;          //<-Scale
    uv*=rot(time);   //<-Rotate
  	uv=abs(uv);       //<-Mirror
    uv-=0.5;          //<-Shift
	}

	//draw a circle
	fragColor=vec4(length(uv)<0.4);
}

void main( void )
{
  vec4 color = vec4(0.0,0.0,0.0,1.0); 
  mainImage(color, gl_FragCoord.xy);
  color.w = 1.0;
  gl_FragColor = color;
}  




