TravisBumgarner / Strangerer-Things

Slack integration for generating Stranger Things light messages.
https://www.youtube.com/watch?v=DL1EOHFlQWA&ab_channel=TravistheMaker
2 stars 0 forks source link

Add Flickery-ness #5

Open TravisBumgarner opened 5 years ago

TravisBumgarner commented 5 years ago

https://media1.giphy.com/media/26ufnw7I96fRGTYFq/giphy.gif?cid=3640f6095c0ebbf561546f5759714ae4

tenth10th commented 5 years ago

When a message isn't coming through, the lights could "flicker" (fade on and off quickly, in random durations). To avoid an obvious "rippling effect", we could also simply turn them all on (and then off) in random order, with (very small) random delays between each light action.

(That might be visually distracting / annoying when there isn't a message coming in - They could just all be on, or slowly fade alternating lights on and off, more like standard holiday light behavior.)

tenth10th commented 5 years ago

(For example, we could store a list of the integers [0 ... 26] and random.shuffle() it each time we want to turn lights on and off, rather than always activating / deactivating them in order.)

TravisBumgarner commented 5 years ago

Random exploration we did into this:


def flicker():
    flicker_duration = 100/1000
    while True:
        FLICKER_THRESHOLD = 990
        flicker_chance = random.randint(0,1000)
        if flicker_chance > FLICKER_THRESHOLD:
            flicker_value = random.randint(0,255)
            flicker_duration = random.randint(0,50)
            pixels[0] = (255,255,255, flicker_value)
        else:
            pixels[0] = OFF
        time.sleep(flicker_duration / 1000)