fullscreen animation

This commit is contained in:
Nordup 2023-06-17 21:16:19 +04:00
parent fdecd5fc50
commit 6d96ff6226
4 changed files with 425 additions and 11 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://5btb7nvgmfhl"]
[gd_scene load_steps=15 format=3 uid="uid://5btb7nvgmfhl"]
[ext_resource type="Script" path="res://scripts/ui/world/home.gd" id="2_l5iu6"]
[ext_resource type="Texture2D" uid="uid://dystd8vvbqwo2" path="res://textures/exit.svg" id="3_1a6fk"]
@ -6,6 +6,8 @@
[ext_resource type="Texture2D" uid="uid://bmju020v33vrv" path="res://textures/home.svg" id="4_5npup"]
[ext_resource type="Script" path="res://scripts/ui/menu/exit_app.gd" id="4_2065t"]
[ext_resource type="PackedScene" uid="uid://ctam0fxigbefk" path="res://scenes/components/search.tscn" id="5_li2do"]
[ext_resource type="Script" path="res://scripts/ui/fullscreen_animation.gd" id="7_1hi62"]
[ext_resource type="Resource" uid="uid://crjhix0osmtnf" path="res://resources/ui_events.res" id="8_8dnbq"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_pveoh"]
bg_color = Color(0.156863, 0.156863, 0.156863, 1)
@ -13,6 +15,134 @@ bg_color = Color(0.156863, 0.156863, 0.156863, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_re7ca"]
bg_color = Color(0.231373, 0.184314, 0.541176, 1)
[sub_resource type="Animation" id="Animation_b8hjg"]
resource_name = "fullscreen"
length = 0.25
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("VBoxContainer/Top:custom_minimum_size")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.25),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Vector2(0, 60), Vector2(0, 60), Vector2(0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("VBoxContainer/Top/HBoxContainer:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("VBoxContainer/Top/Exit:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
[sub_resource type="Animation" id="Animation_ydijj"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("VBoxContainer/Top:custom_minimum_size")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 60)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("VBoxContainer/Top/HBoxContainer:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("VBoxContainer/Top/Exit:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_yny1j"]
resource_name = "initial"
length = 0.25
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("VBoxContainer/Top:custom_minimum_size")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.15, 0.25),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, 60), Vector2(0, 60)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("VBoxContainer/Top/HBoxContainer:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.15, 0.25),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("VBoxContainer/Top/Exit:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.15, 0.25),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7jj8o"]
_data = {
"RESET": SubResource("Animation_ydijj"),
"fullscreen": SubResource("Animation_b8hjg"),
"initial": SubResource("Animation_yny1j")
}
[node name="Menu" type="Control"]
layout_mode = 3
anchors_preset = 15
@ -222,5 +352,13 @@ expand_mode = 1
layout_mode = 2
size_flags_vertical = 3
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_7jj8o")
}
script = ExtResource("7_1hi62")
ui_events = ExtResource("8_8dnbq")
gate_events = ExtResource("3_m632k")
[connection signal="pressed" from="VBoxContainer/Top/HBoxContainer/Home" to="VBoxContainer/Top/HBoxContainer/Home" method="_on_pressed"]
[connection signal="pressed" from="VBoxContainer/Top/Exit" to="VBoxContainer/Top/Exit" method="_on_pressed"]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=22 format=3 uid="uid://kywrsqro3d5i"]
[gd_scene load_steps=27 format=3 uid="uid://kywrsqro3d5i"]
[ext_resource type="Script" path="res://scripts/loading/gate_loader.gd" id="1_uxhy6"]
[ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_q7cvi"]
@ -16,6 +16,7 @@
[ext_resource type="Script" path="res://scripts/ui/world/release_focus.gd" id="16_8emm0"]
[ext_resource type="PackedScene" path="res://scenes/components/hint.tscn" id="17_rve7m"]
[ext_resource type="Texture2D" uid="uid://bvvgx8ij2mdna" path="res://textures/star.png" id="18_o2mtq"]
[ext_resource type="Script" path="res://scripts/ui/fullscreen_animation.gd" id="18_sx3kr"]
[ext_resource type="Texture2D" uid="uid://c5hu6cmvuipg7" path="res://textures/star_filled.png" id="19_y2rfc"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bm5nj"]
@ -33,6 +34,242 @@ draw_center = false
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_a03l7"]
draw_center = false
[sub_resource type="Animation" id="Animation_tper3"]
resource_name = "fullscreen"
length = 0.25
step = 0.0166667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("HBoxContainer/GateInfo:modulate")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [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("HBoxContainer/Spacing:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("HBoxContainer/GateInfo:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, false]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("HBoxContainer/Spacing2:visible")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, false]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("HBoxContainer/WorldCanvas:custom_minimum_size")
tracks/4/interp = 2
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0.1, 0.25),
"transitions": PackedFloat32Array(1, 1.07177),
"update": 0,
"values": [Vector2(1300, 0), Vector2(1920, 0)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("HBoxContainer/WorldCanvas/RenderResult/HideOnPress:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="Animation_beyyv"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("HBoxContainer/GateInfo: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("HBoxContainer/Spacing:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("HBoxContainer/GateInfo:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("HBoxContainer/Spacing2:visible")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("HBoxContainer/WorldCanvas:custom_minimum_size")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1300, 0)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("HBoxContainer/WorldCanvas/RenderResult/HideOnPress:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_77flb"]
resource_name = "initial"
length = 0.25
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("HBoxContainer/GateInfo:modulate")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.15, 0.25),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("HBoxContainer/Spacing:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.15, 0.25),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [false, true]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("HBoxContainer/GateInfo:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.15, 0.25),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [false, true]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("HBoxContainer/Spacing2:visible")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0.15, 0.25),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [false, true]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("HBoxContainer/WorldCanvas:custom_minimum_size")
tracks/4/interp = 2
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.15),
"transitions": PackedFloat32Array(1.07177, 1),
"update": 0,
"values": [Vector2(1920, 0), Vector2(1300, 0)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("HBoxContainer/WorldCanvas/RenderResult/HideOnPress:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_sld6k"]
_data = {
"RESET": SubResource("Animation_beyyv"),
"fullscreen": SubResource("Animation_tper3"),
"initial": SubResource("Animation_77flb")
}
[node name="World" type="Control"]
layout_mode = 3
anchors_preset = 15
@ -44,6 +281,7 @@ size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource("12_jdwjt")
ui_events = ExtResource("9_ir58h")
gate_events = ExtResource("2_q7cvi")
command_events = ExtResource("6_18mgg")
[node name="GateLoader" type="Node" parent="."]
@ -74,11 +312,12 @@ size_flags_horizontal = 0
[node name="RenderResult" type="TextureRect" parent="HBoxContainer/WorldCanvas"]
layout_mode = 1
anchors_preset = 15
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -15.6171
offset_bottom = 15.6329
anchor_bottom = 0.5
offset_top = -365.625
offset_bottom = 365.625
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("7_52jgh")
@ -89,7 +328,7 @@ gate_events = ExtResource("2_q7cvi")
command_events = ExtResource("6_18mgg")
splash_screen = ExtResource("7_52jgh")
[node name="HideOnPress" type="TextureButton" parent="HBoxContainer/WorldCanvas"]
[node name="HideOnPress" type="TextureButton" parent="HBoxContainer/WorldCanvas/RenderResult"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -160,7 +399,6 @@ layout_mode = 2
size_flags_vertical = 3
theme_override_font_sizes/normal_font_size = 24
text = "No description"
fit_content = true
[node name="Url" type="LineEdit" parent="HBoxContainer/GateInfo"]
layout_mode = 2
@ -360,6 +598,15 @@ expand_mode = 1
custom_minimum_size = Vector2(50, 0)
layout_mode = 2
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_sld6k")
}
script = ExtResource("18_sx3kr")
ui_events = ExtResource("9_ir58h")
gate_events = ExtResource("2_q7cvi")
[connection signal="pressed" from="HBoxContainer/WorldCanvas/RenderResult/HideOnPress" to="." method="hide_ui"]
[connection signal="pressed" from="HBoxContainer/GateInfo/Bookmark/Star" to="HBoxContainer/GateInfo" method="_on_star_pressed"]
[connection signal="pressed" from="HBoxContainer/GateInfo/Bookmark/Unstar" to="HBoxContainer/GateInfo" method="_on_unstar_pressed"]

View file

@ -0,0 +1,25 @@
extends AnimationPlayer
@export var ui_events: UiEvents
@export var gate_events: GateEvents
const RESET := "RESET"
const INITIAL := "initial"
const FULLSCREEN := "fullscreen"
var fullscreen := false
func _ready() -> void:
ui_events.visibility_changed.connect(on_visibility_changed)
gate_events.open_gate.connect(func(_url): on_visibility_changed(true))
func on_visibility_changed(visible: bool) -> void:
if visible and fullscreen:
fullscreen = false
play(INITIAL)
if not visible and not fullscreen:
fullscreen = true
play(FULLSCREEN)

View file

@ -1,6 +1,7 @@
extends Control
@export var ui_events: UiEvents
@export var gate_events: GateEvents
@export var command_events: CommandEvents
var mouse_mode: int = Input.MOUSE_MODE_VISIBLE
@ -8,8 +9,9 @@ var _visible: bool = true
func _ready() -> void:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
gate_events.gate_entered.connect(hide_ui)
command_events.set_mouse_mode.connect(set_mouse_mode)
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
func set_mouse_mode(mode: int) -> void:
@ -26,14 +28,16 @@ func _input(event: InputEvent) -> void:
func show_ui() -> void:
if _visible: return
_visible = true
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
ui_events.visibility_changed_emit(true)
func hide_ui() -> void:
if not _visible: return
_visible = false
Input.set_mouse_mode(mouse_mode)
Input.set_mouse_mode(mouse_mode)
ui_events.visibility_changed_emit(false)