Доработка. Отступы для зачёркивания более точные, но не совсем
This commit is contained in:
@@ -28,6 +28,7 @@ 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()
|
||||
@@ -44,17 +45,18 @@ void fragment()
|
||||
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);
|
||||
vec2 uv = UV;
|
||||
rotate_vec2(uv, -rotation, center);
|
||||
float v3 = smoothstep(0.0, 1.0, (uv.x - center.x / 5.0) * sharpness);
|
||||
float v4 = smoothstep(0.0, 1.0, (uv.y - center.y / 5.0) * sharpness);
|
||||
float v5 = smoothstep(0.0, 1.0, (center.x * 2.0 - center.x / 5.0 - uv.x) * sharpness);
|
||||
float v6 = smoothstep(0.0, 1.0, (center.y * 2.0 - center.y / 5.0 - uv.y) * sharpness);
|
||||
COLOR.a += v0 * v1 * v2 * v3 * v4 * v5 * v6;
|
||||
}
|
||||
COLOR.a *= color.a;
|
||||
@@ -66,10 +68,11 @@ void fragment()
|
||||
resource_local_to_scene = true
|
||||
shader = SubResource("Shader_2bftm")
|
||||
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/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"]
|
||||
|
||||
@@ -90,14 +93,13 @@ extends Sprite2D
|
||||
"
|
||||
|
||||
[node name="container" type="PanelContainer"]
|
||||
offset_right = 30.0
|
||||
offset_bottom = 30.0
|
||||
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="."]
|
||||
modulate = Color(1, 1, 1, 0.25)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_0cn5u")
|
||||
patch_margin_left = 10
|
||||
@@ -121,11 +123,11 @@ clip_text = true
|
||||
|
||||
[node name="back" type="Sprite2D" parent="."]
|
||||
material = SubResource("ShaderMaterial_hhdyc")
|
||||
scale = Vector2(30, 30)
|
||||
scale = Vector2(20, 20)
|
||||
texture = SubResource("PlaceholderTexture2D_6nup5")
|
||||
centered = false
|
||||
script = SubResource("GDScript_uyl5d")
|
||||
speed = 1.0
|
||||
speed = 0.0
|
||||
|
||||
[connection signal="resized" from="." to="." method="_on_resized"]
|
||||
[connection signal="toggled" from="button" to="." method="_on_button_toggled"]
|
||||
|
||||
@@ -4,6 +4,14 @@ extends PanelContainer
|
||||
|
||||
var save_modulate: Color
|
||||
|
||||
func set_text(val: String): $button.set_text(val)
|
||||
func set_pressed(val: bool): $button.set_pressed(val)
|
||||
func set_disabled(val: bool): disabled = val
|
||||
func button_connect(button_signal: String, proc: Callable): $button.connect(button_signal, proc)
|
||||
func get_text(): return $button.get_text()
|
||||
func is_pressed(): return $button.is_pressed()
|
||||
func is_toggle_mode(): return $button.is_toggle_mode()
|
||||
|
||||
|
||||
@export var texture_state0: Texture2D = preload('res://data/кнопка-квадрат-0.png'):
|
||||
set(val): $state.set_texture(val)
|
||||
@@ -42,18 +50,14 @@ var save_modulate: Color
|
||||
get: return $button.is_toggle_mode()
|
||||
|
||||
|
||||
func set_text(val: String): $button.set_text(val)
|
||||
func set_pressed(val: bool): $button.set_pressed(val)
|
||||
func set_disabled(val: bool): disabled = val
|
||||
func button_connect(button_signal: String, proc: Callable): $button.connect(button_signal, proc)
|
||||
func get_text(): return $button.get_text()
|
||||
func is_pressed(): return $button.is_pressed()
|
||||
func is_toggle_mode(): return $button.is_toggle_mode()
|
||||
func _on_resized() -> void: $back.scale = size
|
||||
func _on_resized() -> void:
|
||||
$back.scale = size
|
||||
$back.material.set('shader_parameter/scale', size / Vector2(20.0, 20.0))
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
$back.scale = size
|
||||
$back.material.set('shader_parameter/scale', size / Vector2(20.0, 20.0))
|
||||
save_modulate = modulate
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user