pybeamshow/effects/presets.py
2023-02-18 23:17:03 +01:00

57 lines
1.5 KiB
Python

from random import choice
from typing import List
from effects.effect import Effect, color_wheel, Colors
from effects.bouncingspot import BouncingSpot
from effects.doublespot import DoubleSpot
import pygame as pg
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 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),
),
]
#