Rotation only for now

This commit is contained in:
Stefan Bethke 2024-12-16 17:50:30 +01:00
parent 60ffeefd6a
commit 10b89e784f

View file

@ -238,7 +238,7 @@ class Hackertours(Steady):
""" """
Base color yellow, with green wandering back and forth Base color yellow, with green wandering back and forth
""" """
def __init__(self, color, base=(255,255,0), looptime=2.0): def __init__(self, color, base=(255,255,0), looptime=4.0):
super(Hackertours, self).__init__(color) super(Hackertours, self).__init__(color)
self.looptime = looptime self.looptime = looptime
self.base = base self.base = base
@ -246,8 +246,6 @@ class Hackertours(Steady):
def update(self, index, count): def update(self, index, count):
# angle is the position of the highlight on a circle, range [0, 1] # angle is the position of the highlight on a circle, range [0, 1]
angle = (time() / self.looptime + (index + 0.0) / count) % 1.0 angle = (time() / self.looptime + (index + 0.0) / count) % 1.0
# map 0->1, 0.5->0, 1->1 to convert from circle to cylon
angle = abs(angle * 2 - 1)
l = 1 - min(abs(angle - 1 / count) * .9, 1.0 / count) * count l = 1 - min(abs(angle - 1 / count) * .9, 1.0 / count) * count
return ( return (
int(self.r * l + self.base[0] * (1-l)), int(self.r * l + self.base[0] * (1-l)),