1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-27 22:41:56 +08:00

feat: 更新CooldownProgress着色器,添加trailAlpha参数以增强透明度控制

This commit is contained in:
2025-09-06 22:45:48 +08:00
parent 5b9c87acd5
commit 2d42eaea9a
2 changed files with 15 additions and 4 deletions
+13 -3
View File
@@ -1,8 +1,18 @@
[gd_scene load_steps=2 format=3 uid="uid://bnf0o8rmin5v4"]
[gd_scene load_steps=4 format=3 uid="uid://bnf0o8rmin5v4"]
[ext_resource type="Texture2D" uid="uid://b7vxserbhskol" path="res://resources/feeds/banana.svg" id="1_omrjh"]
[ext_resource type="Shader" path="res://shaders/CooldownProgress.gdshader" id="1_vncc3"]
[ext_resource type="Texture2D" uid="uid://16yhngg3jpun" path="res://resources/weapons/purple-crystal.svg" id="2_gmp7s"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_jyenr"]
shader = ExtResource("1_vncc3")
shader_parameter/progress = 0.5
shader_parameter/backAlpha = 0.25
shader_parameter/edgeHeight = 0.05
shader_parameter/trailHeight = 0.3
shader_parameter/trailAlpha = 0.5
[node name="Node2D" type="Node2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_omrjh")
material = SubResource("ShaderMaterial_jyenr")
texture = ExtResource("2_gmp7s")
+2 -1
View File
@@ -3,12 +3,13 @@ uniform float progress:hint_range(0.0, 2.0, 0.01)=0.5;
uniform float backAlpha:hint_range(0.0, 1.0, 0.01)=0.25;
uniform float edgeHeight:hint_range(0.0, 1.0, 0.01)=0.05;
uniform float trailHeight:hint_range(0.0, 1.0, 0.01)=0.3;
uniform float trailAlpha:hint_range(0.0, 1.0, 0.01)=0.5;
void fragment() {
if(UV.y>=progress){
COLOR.a*=backAlpha;
}else if(distance(UV.y,progress)<edgeHeight){
COLOR.rgb*=255.0;
}else if(progress-UV.y<=trailHeight){
COLOR.rgb*=1.0+(trailHeight/(progress-UV.y)-1.0)*0.5;
COLOR.rgb*=1.0+(trailHeight/(progress-UV.y)-1.0)*trailAlpha;
}
}