add strobe

This commit is contained in:
Patrick Moessler 2023-02-23 00:18:11 +01:00
parent 5730142d67
commit fb2b888193

View file

@ -146,6 +146,7 @@ class Beamshow:
framecounter = 0
blackout = False
single_random = False
strobe = False
fps_slidewindow = []
frames_per_beat = 0
while True:
@ -155,10 +156,10 @@ class Beamshow:
if is_beat:
if self.beat_skip_counter > 0:
is_beat = False
print(" skip")
# print(" skip")
self.beat_skip_counter -= 1
else:
print("beat")
# print("beat")
self.beat_skip_counter = self.beat_factor - 1
fps_mean = (
@ -210,12 +211,17 @@ class Beamshow:
self.beat_skip_counter = 0
elif event.key == pg.K_PAGEUP:
self.beat_factor = (
self.beat_factor / 2 if self.beat_factor > 1 else 1
self.beat_factor // 2 if self.beat_factor > 1 else 1
)
print(f"Trigger on every {self.beat_factor} beat")
elif event.key == pg.K_PAGEDOWN:
self.beat_factor = self.beat_factor * 2
print(f"Trigger on every {self.beat_factor} beat")
elif event.key == pg.K_RETURN:
strobe = True
elif event.type == pg.KEYUP:
if event.key == pg.K_RETURN:
strobe = False
if reinitialize:
self.window, self.background = self.initialize()
@ -225,6 +231,11 @@ class Beamshow:
loop = self.render_loop_normal()
next(loop)
if strobe:
self.window.fill(
Colors.White if (framecounter % 4 == 0) else Colors.Black
)
if blackout:
self.window.fill(Colors.Black)