Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Commit

Permalink
Allow random mood blobs color, set mood-blobs-full to random
Browse files Browse the repository at this point in the history
Small change to allow a random start hue for mood blobs - adds a bit of
spice instead of starting at the same color every time.


Former-commit-id: 2b5a025
  • Loading branch information
pdf committed May 10, 2016
1 parent a0b81e9 commit 3ba86a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion effects/mood-blobs-full.json
Expand Up @@ -4,7 +4,7 @@
"args" :
{
"rotationTime" : 60.0,
"color" : [0,0,255],
"colorRandom" : true,
"hueChange" : 30.0,
"blobs" : 5,
"reverse" : false,
Expand Down
5 changes: 5 additions & 0 deletions effects/mood-blobs.py
Expand Up @@ -2,10 +2,12 @@
import time
import colorsys
import math
from random import random

# Get the parameters
rotationTime = float(hyperion.args.get('rotationTime', 20.0))
color = hyperion.args.get('color', (0,0,255))
colorRandom = bool(hyperion.args.get('colorRandom', False))
hueChange = float(hyperion.args.get('hueChange', 60.0))
blobs = int(hyperion.args.get('blobs', 5))
reverse = bool(hyperion.args.get('reverse', False))
Expand Down Expand Up @@ -34,6 +36,9 @@

# Calculate the color data
baseHsv = colorsys.rgb_to_hsv(color[0]/255.0, color[1]/255.0, color[2]/255.0)
if colorRandom:
baseHsv = (random(), baseHsv[1], baseHsv[2])

colorData = bytearray()
for i in range(hyperion.ledCount):
hue = (baseHsv[0] + hueChange * math.sin(2*math.pi * i / hyperion.ledCount)) % 1.0
Expand Down

0 comments on commit 3ba86a1

Please sign in to comment.