Refactor/simplify InfoTextAnimation
This commit is contained in:
parent
0c38a416c0
commit
5b85367e80
2 changed files with 45 additions and 71 deletions
|
@ -191,14 +191,14 @@ func show_error(text: String):
|
|||
|
||||
|
||||
func show_info(text: String, color: Color):
|
||||
info_text_animation.play("RESET")
|
||||
info_text_animation.stop()
|
||||
info_text.text = text
|
||||
info_text.label_settings.font_color = color
|
||||
info_text.show()
|
||||
|
||||
|
||||
func hide_info():
|
||||
info_text_animation.play("RESET")
|
||||
info_text_animation.stop()
|
||||
info_text.hide()
|
||||
|
||||
|
||||
|
|
112
src/main.tscn
112
src/main.tscn
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=11 format=3 uid="uid://busmmqyj42lv5"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://busmmqyj42lv5"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://b7jasa607pvfx" path="res://fonts/Louis George Cafe Bold.ttf" id="1"]
|
||||
[ext_resource type="Script" path="res://src/main.gd" id="2"]
|
||||
|
@ -25,6 +25,9 @@ font_size = 72
|
|||
|
||||
[sub_resource type="FontFile" id="2"]
|
||||
fallbacks = Array[Font]([ExtResource("1")])
|
||||
subpixel_positioning = 0
|
||||
msdf_pixel_range = 14
|
||||
msdf_size = 128
|
||||
cache/0/24/0/ascent = 0.0
|
||||
cache/0/24/0/descent = 0.0
|
||||
cache/0/24/0/underline_position = 0.0
|
||||
|
@ -44,6 +47,39 @@ cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0)
|
|||
font_size = 24
|
||||
font_color = Color(1, 0.309804, 0.309804, 1)
|
||||
|
||||
[sub_resource type="Animation" id="3"]
|
||||
resource_name = "ErrorMessage"
|
||||
length = 6.0
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("InfoText:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 5, 6),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("InfoText:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.15, 0.35, 0.6),
|
||||
"transitions": PackedFloat32Array(1, 0.5, -2, -2),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(8, 0), Vector2(-8, 0), Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_qsyqi"]
|
||||
_data = {
|
||||
"ErrorMessage": SubResource("3")
|
||||
}
|
||||
|
||||
[sub_resource type="FontFile" id="5"]
|
||||
fallbacks = Array[Font]([ExtResource("1")])
|
||||
cache/0/16/0/ascent = 0.0
|
||||
|
@ -61,68 +97,6 @@ cache/0/36/0/scale = 1.0
|
|||
cache/0/36/0/kerning_overrides/16/0 = Vector2(0, 0)
|
||||
cache/0/36/0/kerning_overrides/36/0 = Vector2(0, 0)
|
||||
|
||||
[sub_resource type="Animation" id="3"]
|
||||
resource_name = "ErrorMessage"
|
||||
length = 6.0
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("C/V/InfoTextHolder/InfoText:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 5, 6),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("C/V/InfoTextHolder/InfoText:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.15, 0.35, 0.6),
|
||||
"transitions": PackedFloat32Array(1, 0.5, -2, -2),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(8, 0), Vector2(-8, 0), Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_weygv"]
|
||||
resource_name = "RESET"
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("C/V/InfoTextHolder/InfoText:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("C/V/InfoTextHolder/InfoText:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_qsyqi"]
|
||||
_data = {
|
||||
"ErrorMessage": SubResource("3"),
|
||||
"RESET": SubResource("Animation_weygv")
|
||||
}
|
||||
|
||||
[node name="Main" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
@ -177,6 +151,12 @@ theme_override_fonts/font = SubResource("2")
|
|||
label_settings = SubResource("LabelSettings_81m3s")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="InfoTextAnimation" type="AnimationPlayer" parent="C/V/InfoTextHolder"]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_qsyqi")
|
||||
}
|
||||
|
||||
[node name="KeyboardVBox" type="VBoxContainer" parent="C/V"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
@ -377,12 +357,6 @@ grow_horizontal = 0
|
|||
theme_override_font_sizes/font_size = 28
|
||||
text = "Menu"
|
||||
|
||||
[node name="InfoTextAnimation" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_qsyqi")
|
||||
}
|
||||
|
||||
[connection signal="pressed" from="C/V/KeyboardVBox/HRow3/ButtonBksp" to="." method="_on_ButtonBksp_pressed"]
|
||||
[connection signal="pressed" from="C/V/KeyboardVBox/GuessButton" to="." method="_on_GuessButton_pressed"]
|
||||
[connection signal="pressed" from="MenuButton" to="." method="_on_MenuButton_pressed"]
|
||||
|
|
Loading…
Reference in a new issue