Initial commit.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform vec4 color = vec4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
uniform float thickness = 0.1f;
|
||||
uniform float rotation_speed = 1.0f;
|
||||
|
||||
vec2 rotate(vec2 v, float angle) {
|
||||
return vec2(
|
||||
v.x * cos(angle) + v.y * sin(angle),
|
||||
v.x * sin(angle) - v.y * cos(angle)
|
||||
);
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
float distance_from_centre = distance(vec2(0.5f, 0.5f), UV.xy) * 2.0f;
|
||||
float inner_circle = smoothstep((1.0f - (SCREEN_PIXEL_SIZE.x * 96.0f)) - thickness, 1.0f - thickness, distance_from_centre);
|
||||
float outer_circle = 1.0f - smoothstep((1.0f - (SCREEN_PIXEL_SIZE.x * 96.0f)), 1.0f, distance_from_centre);
|
||||
float throbber_edge = outer_circle * inner_circle;
|
||||
|
||||
vec2 relative = rotate(UV - vec2(0.5f, 0.5f), TIME * rotation_speed);
|
||||
float angle = atan(relative.x, relative.y);
|
||||
|
||||
float t = (angle + PI) / 2.0f / PI;
|
||||
COLOR *= throbber_edge * mix(vec4(color.rgb, 0.0f), vec4(color.rgb, 1.0f), t);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://cdsno15e4ik28
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
[gd_scene format=3 uid="uid://ccy6uvk0tjnsn"]
|
||||
|
||||
[ext_resource type="Material" uid="uid://dqjre1mbrfp6c" path="res://Assets/UI/LoadingThrobber/circular_throbber.material" id="1_o3q45"]
|
||||
|
||||
[node name="CircularThrobber" type="AspectRatioContainer" unique_id=1517631718]
|
||||
material = ExtResource("1_o3q45")
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_right = -1232.0
|
||||
offset_bottom = -672.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=1757903595]
|
||||
material = ExtResource("1_o3q45")
|
||||
layout_mode = 2
|
||||
Reference in New Issue
Block a user