[gd_resource type="ShaderMaterial" load_steps=2 format=2]

[sub_resource type="Shader" id=1]
code = "shader_type canvas_item;
render_mode blend_add;

uniform float speed = 15f;
uniform float size = 0.1f;
uniform float spacing = 36f;
uniform int ammount = 10;

mat2 tex_rotate(float _angle){
	return mat2(vec2(cos(_angle), -sin(_angle)), vec2(sin(_angle), cos(_angle)));
}

void fragment() {
	COLOR = vec4(0f);
	
	for(int i = 0; i < int(ammount); i++){
		vec2 uv = ((UV * 2.0 - 1.0)) * tex_rotate(-radians((float(i)*spacing)+(TIME*speed*float(i+1))));
		if ((atan(uv.x, uv.y) + 3.14 < size * float(i+1))) {
			COLOR = texture(TEXTURE, UV);
		}
	}
	for(int i = 0; i < int(ammount); i++){
		vec2 uv = ((UV * 2.0 - 1.0)) * tex_rotate(-radians((float(i)*spacing)+(-TIME*speed*float(i+1))));
		if ((atan(uv.x, uv.y) + 3.14 < size * float(i+1))) {
			COLOR = texture(TEXTURE, UV);
		}
	}
}"

[resource]
shader = SubResource( 1 )
shader_param/speed = 5.0
shader_param/size = 0.05
shader_param/spacing = 36.0
shader_param/ammount = 9
