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
@@ -5,6 +5,9 @@ extends Control
|
||||
##
|
||||
## Everything that is not part of a quiz lives here.
|
||||
|
||||
## How far a tab slides in from the side when it is chosen.
|
||||
const TAB_SLIDE: float = 60.0
|
||||
|
||||
## Dims the window behind an open popup and keeps clicks from reaching the buttons under it.
|
||||
var popup_backdrop: PopupBackdrop
|
||||
|
||||
@@ -23,6 +26,8 @@ var popup_backdrop: PopupBackdrop
|
||||
|
||||
func _ready() -> void:
|
||||
popup_backdrop = PopupBackdrop.add_to(self, _popups())
|
||||
# Every button grows a little under the mouse and shrinks when clicked
|
||||
ButtonBounce.add_to_every_button(get_tree())
|
||||
if OS.has_feature("macos"):
|
||||
GameLog.debug("is_mac")
|
||||
quiz.search_pressed.connect(show_search)
|
||||
@@ -114,8 +119,14 @@ func show_qr() -> void:
|
||||
func show_tab(tab: StringName) -> void:
|
||||
GameLog.debug("show_tab ", tab)
|
||||
top_bar.select_tab(tab)
|
||||
var was_statistics: bool = statistics_view.visible
|
||||
statistics_view.visible = tab == &"statistics"
|
||||
quiz.visible = !statistics_view.visible
|
||||
# The tab that comes in slides from its side: statistics from the right
|
||||
if statistics_view.visible && !was_statistics:
|
||||
Anim.slide_in(statistics_view, Vector2(TAB_SLIDE, 0))
|
||||
elif quiz.visible && was_statistics:
|
||||
Anim.slide_in(quiz, Vector2(-TAB_SLIDE, 0))
|
||||
if statistics_view.visible:
|
||||
statistics_view.refresh()
|
||||
|
||||
|
||||
Reference in new issue
Block a user