Add animations to popups, points, songs, the winner and the tabs (#48)
Popups fade in while growing and close the reverse way, with the backdrop fading along. The winner gets confetti, bouncing pictures and a score graph that draws itself from the left. Filtered statistics cards and search rows fade in, the tabs slide in from their side, and every button bounces on hover and click (ButtonBounce, now added to all buttons). In the player list the score pops on every point, the first point flashes the row, and a player on match point glows with a "Match point!" tag. A song starting fades in the title, flashes its row (kept across list rebuilds) and pops the play button. Common/anim.gd holds the helpers. A saved "Reduce animations" switch in Settings turns all movement off; the tests use it. The flash colours are theme colours (Palette first_point, match_point, flash) in every theme. Closes #48 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ae231975bd
commit
0fc3be79e1
31 files changed
+1510
-639
No files matched your search
@@ -2,6 +2,9 @@ class_name PlayerRow
|
||||
extends PanelContainer
|
||||
## One player in the player list: their name, points and character, and buttons for
|
||||
## giving and taking points. Clicking the character picks another one.
|
||||
##
|
||||
## The score pops when it changes. The first point of a game makes the row flash, and a
|
||||
## player one point from winning glows and says "Match point!" until that changes.
|
||||
|
||||
signal change_character_clicked
|
||||
signal player_removed
|
||||
@@ -15,6 +18,7 @@ var list_index: int
|
||||
|
||||
@onready var player_name_field: Label = %Name
|
||||
@onready var score_label: Label = %Score
|
||||
@onready var match_point_tag: Label = %MatchPointTag
|
||||
@onready var character_frame: PanelContainer = %CharacterFrame
|
||||
@onready var add_button: Button = %AddPoint
|
||||
@onready var minus_button: Button = %RemovePoint
|
||||
@@ -29,6 +33,9 @@ func _ready() -> void:
|
||||
minus_button.set_shortcut(create_button_shortcut(list_index, true))
|
||||
character.pressed.connect(change_character)
|
||||
remove_player.pressed.connect(func() -> void: player_removed.emit())
|
||||
player_object.player_point_given.connect(_on_score_changed)
|
||||
player_object.player_point_taken.connect(_on_score_changed)
|
||||
player_object.first_point_triggered.connect(_on_first_point)
|
||||
character.mouse_entered.connect(_set_character_hovered.bind(true))
|
||||
character.mouse_exited.connect(_set_character_hovered.bind(false))
|
||||
# Rows take turns being lighter and darker, like the other lists
|
||||
@@ -81,6 +88,36 @@ func set_player_character() -> void:
|
||||
|
||||
func update_score() -> void:
|
||||
score_label.text = str(player_object.player_score)
|
||||
_show_match_point(is_match_point())
|
||||
|
||||
|
||||
## Whether the player is one point from winning. A prepared quiz has no winning score.
|
||||
func is_match_point() -> bool:
|
||||
return !Settings.is_prepared_quiz() && Settings.winning_score > 1 \
|
||||
&& player_object.player_score == Settings.winning_score - 1
|
||||
|
||||
|
||||
func _on_score_changed() -> void:
|
||||
Anim.pop(score_label)
|
||||
|
||||
|
||||
func _on_first_point() -> void:
|
||||
Anim.flash(self, get_theme_color(&"first_point", &"Palette"), Anim.SLOW * 2)
|
||||
Anim.pop(score_label, 1.8, Anim.SLOW)
|
||||
|
||||
|
||||
# The glow and the tag show while the player is on match point
|
||||
func _show_match_point(on: bool) -> void:
|
||||
var glow: Node = get_node_or_null("Pulse")
|
||||
if on == match_point_tag.visible && on == (glow != null):
|
||||
return
|
||||
match_point_tag.visible = on
|
||||
if glow != null:
|
||||
glow.queue_free()
|
||||
glow.name = "PulseEnding"
|
||||
if on:
|
||||
Anim.pulse(self, get_theme_color(&"match_point", &"Palette"))
|
||||
Anim.pop(match_point_tag, 1.4, Anim.SLOW)
|
||||
|
||||
|
||||
func _set_character_hovered(hovered: bool) -> void:
|
||||
|
||||
Reference in new issue
Block a user