[gd_scene load_steps=13 format=3 uid="uid://da7w3vkhadfwe"] [ext_resource type="Script" path="res://scenes/button-flat/nine-patch-button.gd" id="1_ui6sg"] [ext_resource type="Texture2D" uid="uid://ct0ajcwno03h7" path="res://data/кнопка-квадрат-0.png" id="2_0cn5u"] [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; #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; uniform vec2 scale = vec2(1.0, 1.0); void vertex() { 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; vec2 uv = UV; rotate_vec2(uv, -rotation, center); float v3 = smoothstep(0.0, 1.0, (uv.x - center.x / 2.0 / scale.x) * sharpness); float v4 = smoothstep(0.0, 1.0, (uv.y - center.y / 2.0 / scale.y) * sharpness); float v5 = smoothstep(0.0, 1.0, (center.x * 2.0 - center.x / 2.0 / scale.x - uv.x) * sharpness); float v6 = smoothstep(0.0, 1.0, (center.y * 2.0 - center.y / 2.0 / scale.y - uv.y) * sharpness); for (float x = -2.0; x < 2.0; x += 0.03) { float v0 = smoothstep(0.0, 1.0, (tx - UV.x + x) * sharpness + width); float v1 = smoothstep(0.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 * v3 * v4 * v5 * v6; } COLOR.a *= color.a; } } " [sub_resource type="ShaderMaterial" id="ShaderMaterial_hhdyc"] resource_local_to_scene = true shader = SubResource("Shader_2bftm") shader_parameter/rotation = 45.0 shader_parameter/color = Vector4(1, 1, 1, 0.1) shader_parameter/width = 3.0 shader_parameter/speed = 0.0 shader_parameter/disabled = false shader_parameter/scale = Vector2(1, 1) [sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_6nup5"] [sub_resource type="GDScript" id="GDScript_uyl5d"] script/source = "@tool extends Sprite2D @export var speed: float = 0.01: set(val): material.set('shader_parameter/speed', val) get: return material.get('shader_parameter/speed') @export var disabled: bool = false: set(val): material.set('shader_parameter/disabled', val) get: return material.get('shader_parameter/disabled') " [node name="container" type="PanelContainer"] offset_right = 20.0 offset_bottom = 20.0 theme_override_styles/panel = SubResource("1") script = ExtResource("1_ui6sg") toggle_mode = true [node name="state" type="NinePatchRect" parent="."] layout_mode = 2 texture = ExtResource("2_0cn5u") patch_margin_left = 10 patch_margin_top = 10 patch_margin_right = 10 patch_margin_bottom = 10 axis_stretch_horizontal = 2 axis_stretch_vertical = 2 [node name="button" type="Button" parent="."] layout_mode = 2 theme_override_colors/font_outline_color = Color(0, 0, 0, 1) theme_override_constants/outline_size = 4 theme_override_styles/normal = SubResource("6") theme_override_styles/hover = SubResource("2") theme_override_styles/pressed = SubResource("3") theme_override_styles/disabled = SubResource("5") theme_override_styles/focus = SubResource("4") toggle_mode = true clip_text = true [node name="back" type="Sprite2D" parent="."] material = SubResource("ShaderMaterial_hhdyc") scale = Vector2(20, 20) texture = SubResource("PlaceholderTexture2D_6nup5") centered = false script = SubResource("GDScript_uyl5d") speed = 0.0 [connection signal="resized" from="." to="." method="_on_resized"] [connection signal="toggled" from="button" to="." method="_on_button_toggled"] [connection signal="visibility_changed" from="back" to="back" method="_on_visibility_changed"]