From f60e0321590d111c451f1916eedbf4536c88380d Mon Sep 17 00:00:00 2001 From: Naomi Kirby Date: Thu, 8 Aug 2024 17:51:51 -0700 Subject: [PATCH] Tweak chaser animation to prevent zombie traces --- initfs/animations/chasers.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/initfs/animations/chasers.py b/initfs/animations/chasers.py index 1dae8fe..1b0f861 100644 --- a/initfs/animations/chasers.py +++ b/initfs/animations/chasers.py @@ -19,15 +19,14 @@ def __init__(self, badge): self.eye_offset = 0.0 def update(self): - if time.ticks_ms() > self.next: - colour = self.badge.pallet[int(1024*random())][0] - speed = (0.5-((random()-0.5)**2))*1.2*(1 if (random()>0.5) else 0) + if (time.ticks_ms() > self.next) and (len(self.traces) <= self.max_traces): + speed = (0.5-((random()-0.5)**2))*1.2 self.traces.append([ - colour, # colour + self.badge.pallet[int(1024*random())][0], # colour speed, # speed float(random()*len(self.framebuf)), # position - (random()*0.07), # life_rate + 0.01 + (random()*0.05), # life_rate 1.0, # life array.array("f", [0]*len(self.framebuf))] # record )