This commit is contained in:
Auric Vente 2024-07-27 13:44:07 -06:00
parent 14d4588425
commit d1bd618d70
2 changed files with 9 additions and 8 deletions

View File

@ -63,6 +63,7 @@ class Config:
icon_off: str = ""
ant: str = "🐜"
arguments_path: Path
fade_duration: int = 500
@staticmethod
def prepare() -> None:

View File

@ -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)