Skip to content

Commit 653bfa8

Browse files
committed
Ease darken background when dialog enters/exit
1 parent 7c7e91c commit 653bfa8

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

material_maker/darken.gd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ extends ColorRect
33
func _ready():
44
var current_theme : Theme = mm_globals.main_window.theme
55
color = current_theme.get_stylebox("panel", "Panel").bg_color
6-
color.a = 0.80
6+
modulate.a = 0.0
7+
var tween = get_tree().create_tween()
8+
tween.tween_property(self, "modulate:a", 0.8, 0.5).set_trans(Tween.TRANS_CUBIC)
79
_on_resized()
810

911
func _on_resized():

material_maker/darken.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[gd_scene load_steps=2 format=3 uid="uid://cmeh4ewlvp7vx"]
22

3-
[ext_resource type="Script" path="res://material_maker/darken.gd" id="1"]
3+
[ext_resource type="Script" uid="uid://du7vv67kc65qb" path="res://material_maker/darken.gd" id="1"]
44

55
[node name="Darken" type="ColorRect"]
66
anchor_right = 1.0

material_maker/main_window.gd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ func bug_report() -> void:
11891189

11901190
func about() -> void:
11911191
var about_box = preload("res://material_maker/windows/about/about.tscn").instantiate()
1192-
add_child(about_box)
1192+
add_dialog(about_box)
11931193
about_box.hide()
11941194
about_box.popup_centered()
11951195

@@ -1431,6 +1431,10 @@ func add_dialog(dialog : Window):
14311431
if mm_globals.get_config("dialog_dim_background"):
14321432
add_child(background)
14331433
dialog.tree_exited.connect(background.queue_free)
1434+
dialog.tree_exited.connect(func():
1435+
var tween := get_tree().create_tween()
1436+
tween.tween_property(background, "modulate:a", 0.0, 0.3).set_trans(Tween.TRANS_CUBIC)
1437+
tween.tween_callback(background.queue_free))
14341438
add_child(dialog)
14351439

14361440
# Accept dialog

0 commit comments

Comments
 (0)