more presets

This commit is contained in:
Patrick Moessler 2023-02-20 02:01:16 +01:00
parent 6c466feff4
commit ee1286b892

View file

@ -2,16 +2,25 @@ import pygame as pg
from typing import List
from random import choice
from effects.effect import Effect, color_wheel, Colors
from random import choice, randint
from effects.drops import Drops
from effects.effect import Effect, color_darken, color_randomize, color_wheel, Colors
from effects.bouncingspot import BouncingSpot
from effects.doublespot import DoubleSpot
from effects.moonflower import Moonflower
from effects.movingwave import MovingWave
from effects.rotatingpoly import RotatingPoly
from effects.scanreticle import ScanReticle
from effects.starfield import Starfield
class Presets:
def __init__(self, bounds: pg.Rect) -> None:
def __init__(self, bounds: pg.Rect, beat_reactive: bool = False) -> None:
self.bounds = bounds
self.beat_reactive = beat_reactive
def default(self) -> List[Effect]:
return self.Moonflower()
def randomize(self) -> List[Effect]:
return getattr(
@ -30,6 +39,7 @@ class Presets:
DoubleSpot(
bounds=self.bounds,
color=color_wheel(increase=30),
beat_adapt=self.beat_reactive,
radius=100,
fade_out=True,
fade_in=True,
@ -39,8 +49,16 @@ class Presets:
def DoubleBouncingSpotsColorWheel(self) -> List[Effect]:
return [
BouncingSpot(bounds=self.bounds, color=color_wheel()),
BouncingSpot(bounds=self.bounds, color=color_wheel(hue=180)),
BouncingSpot(
bounds=self.bounds,
color=color_wheel(),
sizes=(self.bounds.height / 12, self.bounds.height / 10),
),
BouncingSpot(
bounds=self.bounds,
color=color_wheel(hue=180),
sizes=(self.bounds.height / 12, self.bounds.height / 10),
),
]
def CollidingWaves(self) -> List[Effect]:
@ -74,3 +92,87 @@ class Presets:
y_factor=(2.2, 2.2),
),
]
def RotatingPoly(self) -> List[Effect]:
return [
RotatingPoly(
bounds=self.bounds,
color=color_wheel(increase=(75 if self.beat_reactive else 0)),
beat_color=self.beat_reactive,
size=int(self.bounds.height * 0.8),
outer=randint(3, 8),
velocity=(0.5, 0.5),
rot_speed=1,
x_factor=(0.5, 1.5),
y_factor=(0.5, 3),
)
]
def Moonflower(self) -> List[Effect]:
return [
Moonflower(
bounds=self.bounds,
colors=(
color_wheel(increase=(75 if self.beat_reactive else 0)),
color_wheel(hue=180, increase=(75 if self.beat_reactive else 0)),
),
beat_color=self.beat_reactive,
size=self.bounds.height // 4,
outer=5,
velocity=(1, 1),
rot_speed=1.5,
x_factor=(1, 1),
y_factor=(2.2, 2.2),
)
]
def WhiteStarfield(self) -> List[Effect]:
return [
Starfield(
bounds=self.bounds,
color=Colors.White,
# color=color_randomize(),
fade_in=True,
fade_out=True,
# radius=30,
star_factor=1,
hold=60 * 2,
# beat_adapt=True,
)
]
def ColorStarfield(self) -> List[Effect]:
return [
Starfield(
bounds=self.bounds,
color=color_randomize(),
fade_in=True,
fade_out=True,
# radius=30,
star_factor=1,
hold=60 * 2,
beat_adapt=True,
)
]
def GreenBlueDrops(self) -> List[Effect]:
return [
Drops(
bounds=self.bounds,
colors=(Colors.Green, color_darken(Colors.Blue, 0.2)),
sizes=(self.bounds.width // 40, self.bounds.width // 35),
drop_rate=0.1,
drop_acceleration=0.3,
)
]
def ScanReticle(self) -> List[Effect]:
return [
ScanReticle(
self.bounds,
(Colors.Red, Colors.White),
velocity=(1, 1),
x_factor=(0.4, 1),
y_factor=(0.2, 1),
)
]