From ed0028898f1da684a9f94b286b3d29b13940ca23 Mon Sep 17 00:00:00 2001 From: Rob Kelly Date: Thu, 19 Dec 2024 18:50:06 -0700 Subject: [PATCH] Improved glint in winner alert --- src/shaders/glint_2d.gdshader | 12 +- .../deathmatch_setup/deathmatch_setup.tscn | 54 +-- src/ui/shot_hud/winner_alert.tscn | 364 ++++++++++++------ 3 files changed, 288 insertions(+), 142 deletions(-) diff --git a/src/shaders/glint_2d.gdshader b/src/shaders/glint_2d.gdshader index 89f2a39..41b1b2c 100644 --- a/src/shaders/glint_2d.gdshader +++ b/src/shaders/glint_2d.gdshader @@ -30,36 +30,36 @@ vec2 rotate_uv(vec2 uv, vec2 center, float rotation, bool use_degrees){ } void fragment() { - + vec2 center_uv = UV - vec2(0.5, 0.5); float gradient_to_edge = max(abs(center_uv.x), abs(center_uv.y)); gradient_to_edge = gradient_to_edge * Distortion; gradient_to_edge = 1.0 - gradient_to_edge; vec2 rotaded_uv = rotate_uv(UV, vec2(0.5, 0.5), Rotation_deg, true); - + float remapped_position; { float output_range = Position_Max - Position_Min; remapped_position = Position_Min + output_range * Position; } - + float remapped_time = TIME * Speed + remapped_position; remapped_time = fract(remapped_time); { float output_range = 2.0 - (-2.0); remapped_time = -2.0 + output_range * remapped_time; } - + vec2 offset_uv = vec2(rotaded_uv.xy) + vec2(remapped_time, 0.0); float line = vec3(offset_uv, 0.0).x; line = abs(line); line = gradient_to_edge * line; line = sqrt(line); - + float line_smoothness = clamp(Line_Smoothness, 0.001, 1.0); float offset_plus = Line_Width + line_smoothness; float offset_minus = Line_Width - line_smoothness; - + float remapped_line; { float input_range = offset_minus - offset_plus; diff --git a/src/ui/menus/title_screen/deathmatch_setup/deathmatch_setup.tscn b/src/ui/menus/title_screen/deathmatch_setup/deathmatch_setup.tscn index c0b9f6e..f475f47 100644 --- a/src/ui/menus/title_screen/deathmatch_setup/deathmatch_setup.tscn +++ b/src/ui/menus/title_screen/deathmatch_setup/deathmatch_setup.tscn @@ -66,6 +66,33 @@ _data = { "rotate": SubResource("Animation_c3p73") } +[sub_resource type="Animation" id="Animation_x4wqc"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:disabled") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:modulate") +tracks/1/interp = 2 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 1)] +} + [sub_resource type="Animation" id="Animation_560ro"] resource_name = "fade_out" length = 0.6 @@ -111,33 +138,6 @@ tracks/2/keys = { "values": [true] } -[sub_resource type="Animation" id="Animation_x4wqc"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:disabled") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath(".:modulate") -tracks/1/interp = 2 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Color(1, 1, 1, 1)] -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_s1eyj"] _data = { "RESET": SubResource("Animation_x4wqc"), diff --git a/src/ui/shot_hud/winner_alert.tscn b/src/ui/shot_hud/winner_alert.tscn index ccf2a5e..c4c6864 100644 --- a/src/ui/shot_hud/winner_alert.tscn +++ b/src/ui/shot_hud/winner_alert.tscn @@ -1,10 +1,22 @@ -[gd_scene load_steps=14 format=3 uid="uid://dwyy7tt3nose1"] +[gd_scene load_steps=18 format=3 uid="uid://dwyy7tt3nose1"] [ext_resource type="FontFile" uid="uid://dsa0oh7c0h4pu" path="res://assets/fonts/Racing_Sans_One/RacingSansOne-Regular.ttf" id="1_mxxhu"] [ext_resource type="Texture2D" uid="uid://blfths5fy3a5u" path="res://assets/textures/pip_pattern.png" id="2_plyo3"] [ext_resource type="Script" path="res://src/ui/decorations/text_effects/typewriter/typewriter_label.gd" id="3_vuo1w"] [ext_resource type="AudioStream" uid="uid://c8bxu5lusqevv" path="res://assets/sound/sfx/ui/ecofuture3.wav" id="4_5f42w"] +[sub_resource type="Gradient" id="Gradient_wc65j"] +colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_14byh"] +gradient = SubResource("Gradient_wc65j") +width = 256 +height = 256 +fill = 1 +fill_from = Vector2(0.5, 0.5) +fill_to = Vector2(1, 0.5) +metadata/_snap_enabled = true + [sub_resource type="Gradient" id="Gradient_rgpi4"] colors = PackedColorArray(0.49, 1, 0.643, 1, 1, 1, 1, 1) @@ -14,6 +26,21 @@ fill_from = Vector2(0.5, 0) fill_to = Vector2(0.5, 0.7) metadata/_snap_enabled = true +[sub_resource type="Animation" id="Animation_7bus8"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(-800, -400)] +} + [sub_resource type="Animation" id="Animation_ds0lb"] resource_name = "pan" length = 10.0 @@ -31,31 +58,162 @@ tracks/0/keys = { "values": [Vector2(-800, -400), Vector2(-901, -299)] } -[sub_resource type="Animation" id="Animation_7bus8"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:position") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Vector2(-800, -400)] -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_egd4v"] _data = { "RESET": SubResource("Animation_7bus8"), "pan": SubResource("Animation_ds0lb") } +[sub_resource type="Gradient" id="Gradient_8cbqr"] +offsets = PackedFloat32Array(0.1, 0.3, 0.7, 0.9) +colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0) +metadata/_snap_enabled = true + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_thnrn"] +gradient = SubResource("Gradient_8cbqr") +fill_from = Vector2(0, 0.4) +fill_to = Vector2(1, 0.7) +metadata/_snap_enabled = true + [sub_resource type="Curve" id="Curve_ghy8a"] _data = [Vector2(0, 0), 0.0, 1.68564, 0, 0, Vector2(1, 1), -4.89573, 0.0, 0, 0] point_count = 2 +[sub_resource type="Animation" id="Animation_cm2ua"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("VerticalCenter/GameLabelRoot:anchor_left") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [-0.5] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("VerticalCenter/GameLabelRoot:anchor_right") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [-0.5] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("CaptionLabel:anchor_top") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [0.5] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("CaptionLabel:anchor_bottom") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [0.5] +} +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("VerticalCenter/LabelBack:anchor_left") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [1.5] +} +tracks/5/type = "value" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("VerticalCenter/LabelBack:anchor_right") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [1.5] +} +tracks/6/type = "value" +tracks/6/imported = false +tracks/6/enabled = true +tracks/6/path = NodePath("AudioStreamPlayer:playing") +tracks/6/interp = 1 +tracks/6/loop_wrap = true +tracks/6/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/7/type = "value" +tracks/7/imported = false +tracks/7/enabled = true +tracks/7/path = NodePath("CaptionLabel:rotation") +tracks/7/interp = 1 +tracks/7/loop_wrap = true +tracks/7/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [0.0] +} +tracks/8/type = "value" +tracks/8/imported = false +tracks/8/enabled = true +tracks/8/path = NodePath("VerticalCenter/RadialGradient:modulate") +tracks/8/interp = 1 +tracks/8/loop_wrap = true +tracks/8/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 0)] +} +tracks/9/type = "value" +tracks/9/imported = false +tracks/9/enabled = true +tracks/9/path = NodePath("VerticalCenter/GameLabelRoot/LabelGlintClip/TextureRect:anchor_left") +tracks/9/interp = 1 +tracks/9/loop_wrap = true +tracks/9/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [-0.5] +} +tracks/10/type = "value" +tracks/10/imported = false +tracks/10/enabled = true +tracks/10/path = NodePath("VerticalCenter/GameLabelRoot/LabelGlintClip/TextureRect:anchor_right") +tracks/10/interp = 1 +tracks/10/loop_wrap = true +tracks/10/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [-0.5] +} + [sub_resource type="Animation" id="Animation_f8nc2"] resource_name = "play" length = 6.0 @@ -170,104 +328,41 @@ tracks/8/keys = { "update": 0, "values": [0.0, 0.0, 0.0872665, -0.0872665] } - -[sub_resource type="Animation" id="Animation_cm2ua"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("VerticalCenter/GameLabelRoot:anchor_left") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), +tracks/9/type = "value" +tracks/9/imported = false +tracks/9/enabled = true +tracks/9/path = NodePath("VerticalCenter/RadialGradient:modulate") +tracks/9/interp = 1 +tracks/9/loop_wrap = true +tracks/9/keys = { +"times": PackedFloat32Array(0, 0.6, 1.6, 2.2, 3.2), +"transitions": PackedFloat32Array(1, 1.618, 1, 0.618, 1), "update": 0, -"values": [-0.5] +"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 0), Color(1, 1, 1, 0.470588), Color(1, 1, 1, 0.470588), Color(1, 1, 1, 0)] } -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("VerticalCenter/GameLabelRoot:anchor_right") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), +tracks/10/type = "value" +tracks/10/imported = false +tracks/10/enabled = true +tracks/10/path = NodePath("VerticalCenter/GameLabelRoot/LabelGlintClip/TextureRect:anchor_left") +tracks/10/interp = 1 +tracks/10/loop_wrap = true +tracks/10/keys = { +"times": PackedFloat32Array(2.1, 2.3), +"transitions": PackedFloat32Array(1, 1), "update": 0, -"values": [-0.5] +"values": [-0.5, 1.5] } -tracks/2/type = "value" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("CaptionLabel:anchor_top") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), +tracks/11/type = "value" +tracks/11/imported = false +tracks/11/enabled = true +tracks/11/path = NodePath("VerticalCenter/GameLabelRoot/LabelGlintClip/TextureRect:anchor_right") +tracks/11/interp = 1 +tracks/11/loop_wrap = true +tracks/11/keys = { +"times": PackedFloat32Array(2.1, 2.3), +"transitions": PackedFloat32Array(1, 1), "update": 0, -"values": [0.5] -} -tracks/3/type = "value" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("CaptionLabel:anchor_bottom") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0.5] -} -tracks/4/type = "value" -tracks/4/imported = false -tracks/4/enabled = true -tracks/4/path = NodePath("VerticalCenter/LabelBack:anchor_left") -tracks/4/interp = 1 -tracks/4/loop_wrap = true -tracks/4/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [1.5] -} -tracks/5/type = "value" -tracks/5/imported = false -tracks/5/enabled = true -tracks/5/path = NodePath("VerticalCenter/LabelBack:anchor_right") -tracks/5/interp = 1 -tracks/5/loop_wrap = true -tracks/5/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [1.5] -} -tracks/6/type = "value" -tracks/6/imported = false -tracks/6/enabled = true -tracks/6/path = NodePath("AudioStreamPlayer:playing") -tracks/6/interp = 1 -tracks/6/loop_wrap = true -tracks/6/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] -} -tracks/7/type = "value" -tracks/7/imported = false -tracks/7/enabled = true -tracks/7/path = NodePath("CaptionLabel:rotation") -tracks/7/interp = 1 -tracks/7/loop_wrap = true -tracks/7/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0.0] +"values": [-0.5, 1.5] } [sub_resource type="AnimationLibrary" id="AnimationLibrary_x18w1"] @@ -297,6 +392,18 @@ offset_bottom = 150.0 grow_horizontal = 2 grow_vertical = 2 +[node name="RadialGradient" type="TextureRect" parent="VerticalCenter"] +modulate = Color(1, 1, 1, 0) +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.2 +anchor_top = 0.1 +anchor_right = 0.8 +anchor_bottom = 0.9 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("GradientTexture2D_14byh") + [node name="LabelBack" type="Label" parent="VerticalCenter"] texture_filter = 4 layout_mode = 1 @@ -401,6 +508,44 @@ libraries = { } autoplay = "pan" +[node name="LabelGlintClip" type="Label" parent="VerticalCenter/GameLabelRoot"] +clip_children = 1 +texture_filter = 4 +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -433.0 +offset_top = -191.0 +offset_right = 433.0 +offset_bottom = 191.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 9 +theme_override_fonts/font = ExtResource("1_mxxhu") +theme_override_font_sizes/font_size = 300 +text = "GAME!" + +[node name="TextureRect" type="TextureRect" parent="VerticalCenter/GameLabelRoot/LabelGlintClip"] +custom_minimum_size = Vector2(400, 400) +layout_mode = 1 +anchors_preset = -1 +anchor_left = -0.5 +anchor_top = 0.5 +anchor_right = -0.5 +anchor_bottom = 0.5 +offset_left = -20.0 +offset_top = -20.0 +offset_right = 20.0 +offset_bottom = 20.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("GradientTexture2D_thnrn") + [node name="CaptionLabel" type="RichTextLabel" parent="."] layout_mode = 1 anchors_preset = -1 @@ -433,3 +578,4 @@ autoplay = "play" [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] stream = ExtResource("4_5f42w") +bus = &"SFX"