import pygame as pg from typing import List from random import choice from effects.effect import Effect, color_wheel, Colors from effects.bouncingspot import BouncingSpot from effects.doublespot import DoubleSpot from effects.movingwave import MovingWave class Presets: def __init__(self, bounds: pg.Rect) -> None: self.bounds = bounds def randomize(self) -> List[Effect]: return getattr( self, choice( [ func for func in dir(self) if callable(getattr(self, func)) and not func.startswith("__") ] ), )() def DoubleSpotRandomColor(self) -> List[Effect]: return [ DoubleSpot( bounds=self.bounds, color=color_wheel(increase=30), radius=100, fade_out=True, fade_in=True, hold=60, ) ] def DoubleBouncingSpotsColorWheel(self) -> List[Effect]: return [ BouncingSpot(bounds=self.bounds, color=color_wheel()), BouncingSpot(bounds=self.bounds, color=color_wheel(hue=180)), ] def CollidingWaves(self) -> List[Effect]: return [ MovingWave( bounds=pg.rect.Rect(0, 0, self.bounds.width, self.bounds.height), wave_count=5, wave_height=self.bounds.height // 6, thickness=20, ), MovingWave( bounds=pg.rect.Rect(0, 0, self.bounds.width, self.bounds.height), hue=180, wave_count=5, wave_height=self.bounds.height // 6, start_phase=120, start_pos=(0, self.bounds.height * 5 // 6), thickness=20, ), ] def BouncingSpotWhite(self) -> List[Effect]: return [ BouncingSpot( bounds=self.bounds, color=Colors.White, # color=color_wheel(), sizes=(self.bounds.height / 8, self.bounds.height / 8), velocity=(1, 1), x_factor=(1, 1), y_factor=(2.2, 2.2), ), ]