Skip to content

Commit

Permalink
Tweak chaser animation to prevent zombie traces
Browse files Browse the repository at this point in the history
  • Loading branch information
oskirby committed Aug 9, 2024
1 parent 0d292b3 commit f60e032
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions initfs/animations/chasers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit f60e032

Please sign in to comment.