From 74124bc35abe90080a2b13a58b4649046d9623c3 Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Wed, 25 Sep 2024 07:40:44 +0200 Subject: [PATCH] Pick random effect from effect gallery --- src/oterm/app/splash.py | 62 +++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/src/oterm/app/splash.py b/src/oterm/app/splash.py index d62ff32..257d925 100644 --- a/src/oterm/app/splash.py +++ b/src/oterm/app/splash.py @@ -1,5 +1,10 @@ +import random +from typing import Any, Tuple + from textualeffects.widgets import SplashScreen +from oterm.app.widgets.effect import EffectType + logo = """ @@@@@@. :@@@@@@ @@@@@@@@@ @@@@@@@@@ @@ -42,12 +47,53 @@ @. .@ """ +effects: list[Tuple[EffectType, dict[str, Any]]] = [ + ( + "Beams", + { + "beam_delay": 3, + "beam_gradient_steps": 2, + "beam_gradient_frames": 2, + "final_gradient_steps": 2, + "final_gradient_frames": 2, + "final_wipe_speed": 5, + }, + ), + ( + "BouncyBalls", + { + "ball_delay": 1, + }, + ), + ( + "Expand", + { + "movement_speed": 0.1, + }, + ), + ( + "Pour", + { + "pour_speed": 3, + }, + ), + ( + "Rain", + {}, + ), + ( + "RandomSequence", + {}, + ), + ( + "Scattered", + {}, + ), + ( + "Slide", + {}, + ), +] -splash = SplashScreen( - text=logo, - effect="Spotlights", - config={ - "search_duration": 100, - "spotlight_count": 3, - }, -) +effect = random.choice(effects) +splash = SplashScreen(text=logo, effect=effect[0], config=effect[1])