From d1bd618d702790f1fb0103d3ef0be599f64581d6 Mon Sep 17 00:00:00 2001 From: Auric Vente Date: Sat, 27 Jul 2024 13:44:07 -0600 Subject: [PATCH] Mods --- cromulant/config.py | 1 + cromulant/game.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cromulant/config.py b/cromulant/config.py index 111a663..a723812 100644 --- a/cromulant/config.py +++ b/cromulant/config.py @@ -63,6 +63,7 @@ class Config: icon_off: str = "❌" ant: str = "🐜" arguments_path: Path + fade_duration: int = 500 @staticmethod def prepare() -> None: diff --git a/cromulant/game.py b/cromulant/game.py index 8f22259..e00c068 100644 --- a/cromulant/game.py +++ b/cromulant/game.py @@ -155,18 +155,18 @@ class Game: if fade: opacity_effect = QGraphicsOpacityEffect(item) item.setGraphicsEffect(opacity_effect) - fade_in = QPropertyAnimation(opacity_effect, b"opacity") - fade_in.setDuration(500) - fade_in.setStartValue(0) - fade_in.setEndValue(1) - fade_in.setEasingCurve(QEasingCurve.InOutQuad) - fade_in.finished.connect(lambda: Game.animations.remove(fade_in)) - Game.animations.append(fade_in) + animation = QPropertyAnimation(opacity_effect, b"opacity") + animation.setDuration(Config.fade_duration) + animation.setStartValue(0) + animation.setEndValue(1) + animation.setEasingCurve(QEasingCurve.InOutQuad) + animation.finished.connect(lambda: Game.animations.remove(animation)) + Game.animations.append(animation) Window.view.insertWidget(0, item) if fade: - fade_in.start() + animation.start() while Window.view.count() > Config.max_updates: item = Window.view.takeAt(Window.view.count() - 1)