More text + clean code a tad

This commit is contained in:
Neale Pickett 2020-03-14 21:44:43 -06:00
parent cefee45052
commit 07adab99cf
2 changed files with 17 additions and 8 deletions

View File

@ -9,9 +9,21 @@ This port is running on a 1x1 stick of wood,
with tissue paper around it. with tissue paper around it.
It doesn't display anything significant. It doesn't display anything significant.
It just looks interesting. The idea is to have something to look at if you're idle,
without it being a distraction from more pressing issues.
If you're familiar with the album "music for airports",
it's that.
Most people, when they see it, Most people, after watching it for a bit,
form different ideas about what it's displaying. form different ideas about what it's displaying.
That's cool. That's cool.
History
-------
I was trying to make pixels fade in and out,
and got the math wrong.
But what I wound up with looked more interesting
than what I was trying to make,
so I kept it.

View File

@ -36,7 +36,6 @@ class GlitchPixel:
bmask = (0xff * self.step // 32) & 0xff bmask = (0xff * self.step // 32) & 0xff
if self.step > self.nsteps/2: if self.step > self.nsteps/2:
bmask = 0xff - bmask bmask = 0xff - bmask
#bmask = 0xff >> abs(4 - self.step)
mask = (bmask << 16) | (bmask << 8) | (bmask << 0) mask = (bmask << 16) | (bmask << 8) | (bmask << 0)
color = self.color & mask color = self.color & mask
grid[self.pos] = color grid[self.pos] = color
@ -47,18 +46,16 @@ class GlitchPixel:
def fade(): def fade():
reps = 300 + random.randrange(GRIDLEN) reps = 300 + random.randrange(GRIDLEN)
hue = random.randrange(1000) hue = random.randrange(256)
colors = [fancy.CHSV(hue, 255, v).pack() for v in range(0, 256, 32)] colors = [fancy.CHSV(hue, 255, v).pack() for v in range(0, 256, 32)]
rcolors = colors[:] rcolors = colors[:]
rcolors.reverse() rcolors.reverse()
colors = colors + rcolors
for count in range(reps): for count in range(reps):
pos = count % GRIDLEN pos = count % GRIDLEN
for color in colors: for color in colors:
grid[pos] = color grid[pos] = color
pos -= 1 pos -= 1
for color in rcolors:
grid[pos] = color
pos -= 1
grid.show() grid.show()
def singleCursor(): def singleCursor():
@ -88,7 +85,7 @@ def glitchPulse():
p = GlitchPixel() p = GlitchPixel()
pixels.append(p) pixels.append(p)
for f in range(256): for f in range(1000):
for p in pixels: for p in pixels:
p.frame() p.frame()
grid.show() grid.show()