Доработка. Кнопка с зачёркиванием
This commit is contained in:
@@ -5,42 +5,64 @@
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="1"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="6"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="2"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="3"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="5"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="4"]
|
||||
|
||||
[sub_resource type="Shader" id="Shader_2bftm"]
|
||||
code = "shader_type canvas_item;
|
||||
|
||||
uniform vec4 color_gap = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
uniform vec4 color_stripe = vec4(0.3, 0.3, 0.3, 0.7);
|
||||
uniform float divisions = 50.0; // increase for more stripe density
|
||||
uniform float stripe_bias = 2.0; // 1.0 means no stripes; 2.0 means stripes and gaps are equal size
|
||||
uniform float speed = 0.01;
|
||||
uniform float angle = 0.7854; // in radians
|
||||
#include \"res://shaders/tools.gdshaderinc\"
|
||||
|
||||
const vec2 center = vec2(0.125, 0.125);
|
||||
const float sharpness = 300.0;
|
||||
|
||||
uniform float rotation = 0.0;
|
||||
uniform vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
uniform float width = 1.0;
|
||||
uniform float speed = 1.0;
|
||||
uniform bool disabled = false;
|
||||
|
||||
void fragment()
|
||||
|
||||
void vertex()
|
||||
{
|
||||
float w = cos(angle) * UV.x + sin(angle) * UV.y - speed * TIME;
|
||||
if ((floor(mod(w * divisions, stripe_bias)) < 0.0001) && disabled)
|
||||
{
|
||||
COLOR = color_gap;
|
||||
}
|
||||
else
|
||||
{
|
||||
COLOR = color_stripe;
|
||||
}
|
||||
rotate_vec2(UV, rotation, center);
|
||||
}
|
||||
|
||||
|
||||
void fragment()
|
||||
{
|
||||
COLOR = color;
|
||||
if (disabled)
|
||||
{
|
||||
float ds = 1.0 / sharpness;
|
||||
float tx = float(int(TIME * 1000.0 * speed) % 10000) / 1000.0 * center.x + center.x;
|
||||
COLOR.a = 0.0;
|
||||
for (float x = -2.0; x < 2.0; x += 0.03)
|
||||
{
|
||||
float v0 = smoothstep(-1.0, 1.0, (tx - UV.x + x) * sharpness + width);
|
||||
float v1 = smoothstep(-1.0, 1.0, (UV.x - tx - x) * sharpness + width);
|
||||
float v2 = smooth_px(length(UV.x - center.x), center.x * 2.0 - ds, ds);
|
||||
COLOR.a += v0 * v1 * v2;
|
||||
}
|
||||
COLOR.a *= color.a;
|
||||
}
|
||||
}
|
||||
"
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hhdyc"]
|
||||
resource_local_to_scene = true
|
||||
shader = SubResource("Shader_2bftm")
|
||||
shader_parameter/color_gap = Vector4(1, 1, 1, 0.3)
|
||||
shader_parameter/color_stripe = Vector4(0, 0, 1, 0)
|
||||
shader_parameter/divisions = 50.0
|
||||
shader_parameter/stripe_bias = 2.0
|
||||
shader_parameter/speed = 0.0
|
||||
shader_parameter/angle = 0.7854
|
||||
shader_parameter/rotation = 45.0
|
||||
shader_parameter/color = Vector4(1, 1, 1, 0.2)
|
||||
shader_parameter/width = 2.0
|
||||
shader_parameter/speed = 1.0
|
||||
shader_parameter/disabled = false
|
||||
|
||||
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_6nup5"]
|
||||
@@ -61,16 +83,6 @@ extends Sprite2D
|
||||
get: return material.get('shader_parameter/disabled')
|
||||
"
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="6"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="2"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="3"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="5"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="4"]
|
||||
|
||||
[node name="container" type="PanelContainer"]
|
||||
offset_right = 30.0
|
||||
offset_bottom = 30.0
|
||||
@@ -88,14 +100,6 @@ patch_margin_bottom = 10
|
||||
axis_stretch_horizontal = 2
|
||||
axis_stretch_vertical = 2
|
||||
|
||||
[node name="back" type="Sprite2D" parent="."]
|
||||
material = SubResource("ShaderMaterial_hhdyc")
|
||||
scale = Vector2(30, 30)
|
||||
texture = SubResource("PlaceholderTexture2D_6nup5")
|
||||
centered = false
|
||||
script = SubResource("GDScript_uyl5d")
|
||||
speed = 0.0
|
||||
|
||||
[node name="button" type="Button" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
@@ -108,6 +112,14 @@ theme_override_styles/focus = SubResource("4")
|
||||
toggle_mode = true
|
||||
clip_text = true
|
||||
|
||||
[node name="back" type="Sprite2D" parent="."]
|
||||
material = SubResource("ShaderMaterial_hhdyc")
|
||||
scale = Vector2(30, 30)
|
||||
texture = SubResource("PlaceholderTexture2D_6nup5")
|
||||
centered = false
|
||||
script = SubResource("GDScript_uyl5d")
|
||||
speed = 1.0
|
||||
|
||||
[connection signal="resized" from="." to="." method="_on_resized"]
|
||||
[connection signal="visibility_changed" from="back" to="back" method="_on_visibility_changed"]
|
||||
[connection signal="toggled" from="button" to="." method="_on_button_toggled"]
|
||||
[connection signal="visibility_changed" from="back" to="back" method="_on_visibility_changed"]
|
||||
|
||||
Reference in New Issue
Block a user