Рефактор.
This commit is contained in:
@@ -2,64 +2,16 @@
|
||||
|
||||
[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"]
|
||||
[ext_resource type="Shader" path="res://shaders/strips.gdshader" id="2_5ngiq"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="1"]
|
||||
|
||||
[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 = ExtResource("2_5ngiq")
|
||||
shader_parameter/rotation = 0.0
|
||||
shader_parameter/color = Vector4(1, 1, 1, 0.1)
|
||||
shader_parameter/width = 3.0
|
||||
shader_parameter/width = 1.0
|
||||
shader_parameter/speed = 0.0
|
||||
shader_parameter/disabled = false
|
||||
shader_parameter/scale = Vector2(1, 1)
|
||||
|
||||
Reference in New Issue
Block a user