mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Expand effect engine & ui update (#445)
* update
* update
* update
* .
* .
* .
* update
* .
* .
* .
* .
* update
* .
* update
* .
* update
* update
* update
* update
* update
* update
* .
* update
* update
* update
* .
* .
* .
* Revert "."
This reverts commit 4dd6404b32
.
* update
* .
* .
* .
* .
* .
* .
* .
* .
* .
* .
* .
* ...
* .
* .
* .
* .
* .
* .
* .
* .
* .
* update
* update
* update
* remove svg and pic
* colorpicker imgs to base64 to prevent delayed load if not cached
* fix json2python func
* update swirl with rgba
* add double swirl, tune default val in schema, update explanation
* adjust swirl.py
* FileObserver for config checks with timer as fallback (#4)
This commit is contained in:
15
effects/atomic.json
Normal file
15
effects/atomic.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name" : "Atomic swirl",
|
||||
"script" : "swirl.py",
|
||||
"args" :
|
||||
{
|
||||
"rotation-time" : 25.0,
|
||||
"center_x" : 0.5,
|
||||
"center_y" : 0.5,
|
||||
"reverse" : false,
|
||||
"custom-colors":[[0,0,0],[0,0,0],[255,255,0],[0,0,0],[0,0,0],[255,255,0],[0,0,0],[0,0,0],[255,255,0]],
|
||||
"random-center":false,
|
||||
"custom-colors2":[],
|
||||
"enable-second":false
|
||||
}
|
||||
}
|
@@ -1,80 +0,0 @@
|
||||
import hyperion
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
def myRange(index, margin):
|
||||
return [i % hyperion.ledCount for i in range(index-margin, index+margin+1)]
|
||||
|
||||
""" Define some variables """
|
||||
sleepTime = 1
|
||||
ledCount = hyperion.ledCount
|
||||
|
||||
offset = hyperion.args.get('offset', 0)
|
||||
direction = bool(hyperion.args.get('direction', False))
|
||||
|
||||
hourMargin = hyperion.args.get('hour-margin', 2)
|
||||
minuteMargin = hyperion.args.get('minute-margin', 1)
|
||||
secondMargin = hyperion.args.get('second-margin', 0)
|
||||
|
||||
hourColor = hyperion.args.get('hour-color', (255,0,0))
|
||||
minuteColor = hyperion.args.get('minute-color', (0,255,0))
|
||||
secondColor = hyperion.args.get('second-color', (0,0,255))
|
||||
|
||||
markerColor = hyperion.args.get('marker-color', (255,255,255))
|
||||
|
||||
marker = ledCount/4
|
||||
markers = (0+offset, int(marker + offset) % ledCount, int(2*marker + offset) % ledCount, int(3*marker + offset) % ledCount)
|
||||
|
||||
""" The effect loop """
|
||||
while not hyperion.abort():
|
||||
|
||||
""" The algorithm to calculate the change in color """
|
||||
led_data = bytearray()
|
||||
|
||||
now = datetime.now()
|
||||
h = now.hour
|
||||
m = now.minute
|
||||
s = now.second
|
||||
|
||||
hmin = float(h+(1/60*m))
|
||||
|
||||
if hmin > 12:
|
||||
hmin -= 12
|
||||
|
||||
hour = float(hmin/12 * ledCount)
|
||||
led_hour = int(hour + offset) % ledCount
|
||||
|
||||
minute = m/60. * ledCount
|
||||
led_minute = int(minute + offset) % ledCount
|
||||
|
||||
second = s/60. * ledCount
|
||||
led_second = int(second + offset) % ledCount
|
||||
|
||||
hourRange = myRange(led_hour, hourMargin)
|
||||
minuteRange = myRange(led_minute, minuteMargin)
|
||||
secondRange = myRange(led_second, secondMargin)
|
||||
|
||||
for i in range(ledCount):
|
||||
blend = [0, 0, 0]
|
||||
|
||||
if i in markers:
|
||||
blend = markerColor
|
||||
|
||||
if i in hourRange:
|
||||
blend = hourColor
|
||||
|
||||
if i in minuteRange:
|
||||
blend = minuteColor
|
||||
|
||||
if i in secondRange:
|
||||
blend = secondColor
|
||||
|
||||
led_data += bytearray((int(blend[0]), int(blend[1]), int(blend[2])))
|
||||
|
||||
""" send the data to hyperion """
|
||||
hyperion.setColor(led_data)
|
||||
|
||||
""" sleep for a while """
|
||||
timediff = (datetime.now()-now).microseconds/1000000.
|
||||
time.sleep(sleepTime-timediff)
|
||||
|
78
effects/double-swirl.json
Normal file
78
effects/double-swirl.json
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"args": {
|
||||
"center_x": 0.5,
|
||||
"center_x2": 0.5,
|
||||
"center_y": 0.5,
|
||||
"center_y2": 0.5,
|
||||
"custom-colors": [
|
||||
[
|
||||
255,
|
||||
0,
|
||||
0
|
||||
],
|
||||
[
|
||||
20,
|
||||
0,
|
||||
255
|
||||
]
|
||||
],
|
||||
"custom-colors2": [
|
||||
[
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
[
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
[
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
[
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
[
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
],
|
||||
"enable-second": true,
|
||||
"random-center": false,
|
||||
"random-center2": false,
|
||||
"reverse": false,
|
||||
"reverse2": true,
|
||||
"rotation-time": 25
|
||||
},
|
||||
"name": "Double swirl",
|
||||
"script": "swirl.py"
|
||||
}
|
8
effects/flag.json
Normal file
8
effects/flag.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "Flags Germany/Sweden",
|
||||
"script": "flag.py",
|
||||
"args": {
|
||||
"countries":["de","se"],
|
||||
"switch-time": 2
|
||||
}
|
||||
}
|
183
effects/flag.py
Normal file
183
effects/flag.py
Normal file
@@ -0,0 +1,183 @@
|
||||
import hyperion, time
|
||||
hyperion.imageMinSize(10,10)
|
||||
|
||||
iW = hyperion.imageWidth()
|
||||
iH = hyperion.imageHeight()
|
||||
countries = hyperion.args.get('countries', ("de","at"))
|
||||
duration = int(hyperion.args.get('switch-time', 5))
|
||||
imgIds = []
|
||||
nr = 0
|
||||
|
||||
def switchImage():
|
||||
global nr
|
||||
if nr >= len(imgIds):
|
||||
nr = 0
|
||||
hyperion.imageShow(imgIds[nr])
|
||||
nr += 1
|
||||
|
||||
def printFlag(country):
|
||||
# official country codes
|
||||
#############
|
||||
# EU flags -> missing: cyprus, UK
|
||||
#############
|
||||
# de flag (Germany)
|
||||
if country == "de":
|
||||
hyperion.imageSolidFill(0, 0, iW, int(iH*0.33), 0, 0, 0)
|
||||
hyperion.imageSolidFill(0, int(iH*0.33), iW, int(iH*0.33), 221, 0, 0)
|
||||
hyperion.imageSolidFill(0, int(iH*0.66), iW, iH, 255, 206, 0)
|
||||
|
||||
# at flag (Austria)
|
||||
if country == "at":
|
||||
hyperion.imageSolidFill(237, 41, 57)
|
||||
hyperion.imageSolidFill(0, int(iH*0.33), iW, int(iH*0.33), 255, 255, 255)
|
||||
|
||||
# fr flag (France)
|
||||
if country == "fr":
|
||||
hyperion.imageSolidFill(0, 0, int(iW*0.33), iH, 0, 35, 149)
|
||||
hyperion.imageSolidFill(int(iW*0.33), 0, int(iW*0.33), iH, 255, 255, 255)
|
||||
hyperion.imageSolidFill(int(iW*0.66), 0, iW, iH, 237, 41, 57)
|
||||
|
||||
# be flag (Belgium)
|
||||
if country == "be":
|
||||
hyperion.imageSolidFill(0, 0, int(iW*0.33), iH, 0, 0, 0)
|
||||
hyperion.imageSolidFill(int(iW*0.33), 0, int(iW*0.33), iH, 255, 224, 66)
|
||||
hyperion.imageSolidFill(int(iW*0.66), 0, iW, iH, 237, 41, 57)
|
||||
|
||||
# it flag (Italy)
|
||||
if country == "it":
|
||||
hyperion.imageSolidFill(0, 0, int(iW*0.33), iH, 0, 146, 70)
|
||||
hyperion.imageSolidFill(int(iW*0.33), 0, int(iW*0.33), iH, 255, 255, 255)
|
||||
hyperion.imageSolidFill(int(iW*0.66), 0, iW, iH, 206, 43, 55)
|
||||
|
||||
# es flag (Spain)
|
||||
if country == "es":
|
||||
hyperion.imageSolidFill(198, 11, 30)
|
||||
hyperion.imageSolidFill(0, int(iH*0.25), iW, int(iH*0.55), 255, 196, 0)
|
||||
|
||||
# bg flag (Bulgaria)
|
||||
if country == "bg":
|
||||
hyperion.imageSolidFill(0, 0, iW, int(iH*0.33), 255, 255, 255)
|
||||
hyperion.imageSolidFill(0, int(iH*0.33), iW, int(iH*0.33), 0, 150, 110)
|
||||
hyperion.imageSolidFill(0, int(iH*0.66), iW, iH, 214, 38, 18)
|
||||
|
||||
# ee flag (Estonia)
|
||||
if country == "ee":
|
||||
hyperion.imageSolidFill(0, 0, iW, int(iH*0.33), 72, 145, 217)
|
||||
hyperion.imageSolidFill(0, int(iH*0.33), iW, int(iH*0.33), 0, 0, 0)
|
||||
hyperion.imageSolidFill(0, int(iH*0.66), iW, iH, 255, 255, 255)
|
||||
|
||||
# dk flag (Denmark)
|
||||
if country == "dk":
|
||||
hyperion.imageSolidFill(198, 12, 48)
|
||||
hyperion.imageDrawLine(int(iW*0.35), 0, int(iW*0.35), iH, int(iW*0.13), 255, 255, 255)
|
||||
hyperion.imageDrawLine(0, int(iH*0.5), iW, int(iH*0.5), int(iW*0.13), 255, 255, 255)
|
||||
|
||||
# fi flag (Finland)
|
||||
if country == "fi":
|
||||
hyperion.imageSolidFill(255, 255, 255)
|
||||
hyperion.imageDrawLine(int(iW*0.35), 0, int(iW*0.35), iH, int(iW*0.18), 0, 53, 128)
|
||||
hyperion.imageDrawLine(0, int(iH*0.5), iW, int(iH*0.5), int(iW*0.18), 0, 53, 128)
|
||||
|
||||
# hu flag (Hungary)
|
||||
if country == "hu":
|
||||
hyperion.imageSolidFill(0, 0, iW, int(iH*0.33), 205, 42, 62)
|
||||
hyperion.imageSolidFill(0, int(iH*0.33), iW, int(iH*0.33), 255, 255, 255)
|
||||
hyperion.imageSolidFill(0, int(iH*0.66), iW, iH, 67, 111, 77)
|
||||
|
||||
# ie flag (Ireland)
|
||||
if country == "ie":
|
||||
hyperion.imageSolidFill(0, 0, int(iW*0.33), iH, 0, 155, 72)
|
||||
hyperion.imageSolidFill(int(iW*0.33), 0, int(iW*0.33), iH, 255, 255, 255)
|
||||
hyperion.imageSolidFill(int(iW*0.66), 0, iW, iH, 255, 121, 0)
|
||||
|
||||
# lv flag (Latvia)
|
||||
if country == "lv":
|
||||
hyperion.imageSolidFill(158, 48, 57)
|
||||
hyperion.imageDrawLine(0, int(iH*0.5), iW, int(iH*0.5), int(iH*0.2), 255, 255, 255)
|
||||
|
||||
# lt flag (Lithuanian)
|
||||
if country == "lt":
|
||||
hyperion.imageSolidFill(0, 0, iW, int(iH*0.33), 253, 185, 19)
|
||||
hyperion.imageSolidFill(0, int(iH*0.33), iW, int(iH*0.33), 0, 106, 68)
|
||||
hyperion.imageSolidFill(0, int(iH*0.66), iW, iH, 193, 39, 45)
|
||||
|
||||
# lu flag (Luxembourg)
|
||||
if country == "lu":
|
||||
hyperion.imageSolidFill(0, 0, iW, int(iH*0.33), 237, 41, 57)
|
||||
hyperion.imageSolidFill(0, int(iH*0.33), iW, int(iH*0.33), 255, 255, 255)
|
||||
hyperion.imageSolidFill(0, int(iH*0.66), iW, iH, 0, 161, 222)
|
||||
|
||||
# mt flag (Malta)
|
||||
if country == "mt":
|
||||
hyperion.imageSolidFill(0, 0, int(iW*0.5), iH, 255, 255, 255)
|
||||
hyperion.imageSolidFill(int(iW*0.5), 0, int(iW*0.5), iH, 207, 20, 43)
|
||||
|
||||
# nl flag (Netherlands)
|
||||
if country == "nl":
|
||||
hyperion.imageSolidFill(0, 0, iW, int(iH*0.33), 174, 28, 40)
|
||||
hyperion.imageSolidFill(0, int(iH*0.33), iW, int(iH*0.33), 255, 255, 255)
|
||||
hyperion.imageSolidFill(0, int(iH*0.66), iW, iH, 33, 70, 139)
|
||||
|
||||
# pl flag (Poland)
|
||||
if country == "pl":
|
||||
hyperion.imageSolidFill(255, 255, 255)
|
||||
hyperion.imageSolidFill(0, int(iH*0.5), iW, iH, 220, 20, 60)
|
||||
|
||||
# pt flag (Portugal)
|
||||
if country == "pt":
|
||||
hyperion.imageSolidFill(0, 102, 0)
|
||||
hyperion.imageSolidFill(int(iW*0.4), 0, iW, iH, 255, 0, 0)
|
||||
|
||||
# ro flag (Romania)
|
||||
if country == "ro":
|
||||
hyperion.imageSolidFill(0, 0, int(iW*0.33), iH, 0, 43, 127)
|
||||
hyperion.imageSolidFill(int(iW*0.33), 0, int(iW*0.33), iH, 252, 209, 22)
|
||||
hyperion.imageSolidFill(int(iW*0.66), 0, iW, iH, 206, 17, 38)
|
||||
|
||||
# sl flag (Slovakia/Slovenia)
|
||||
if country == "sl":
|
||||
hyperion.imageSolidFill(0, 0, iW, int(iH*0.33), 255, 255, 255)
|
||||
hyperion.imageSolidFill(0, int(iH*0.33), iW, int(iH*0.33), 11, 78, 162)
|
||||
hyperion.imageSolidFill(0, int(iH*0.66), iW, iH, 238, 28, 37)
|
||||
|
||||
# se flag (Sweden)
|
||||
if country == "se":
|
||||
hyperion.imageSolidFill(0, 106, 167)
|
||||
hyperion.imageDrawLine(int(iW*0.35), 0, int(iW*0.35), iH, int(iW*0.14), 254, 204, 0)
|
||||
hyperion.imageDrawLine(0, int(iH*0.5), iW, int(iH*0.5), int(iW*0.14), 254, 204, 0)
|
||||
|
||||
# cz flag (Czech Republic)
|
||||
if country == "cz":
|
||||
hyperion.imageSolidFill(255, 255, 255)
|
||||
hyperion.imageSolidFill(0, int(iH*0.5), iW, iH, 215, 20, 26)
|
||||
hyperion.imageDrawPolygon(bytearray([0,0,int(iH*0.5),int(iH*0.5),0,iH]),17, 69, 126)
|
||||
|
||||
# gr flag (Greece)
|
||||
if country == "gr":
|
||||
hyperion.imageSolidFill(13, 94, 175)
|
||||
hyperion.imageDrawLine(int(iW*0.35), int(iH*0.15), iW, int(iH*0.15),int(0.1*iH), 255, 255, 255)
|
||||
hyperion.imageDrawLine(int(iW*0.35), int(iH*0.35), iW, int(iH*0.35),int(0.1*iH), 255, 255, 255)
|
||||
hyperion.imageDrawLine(0, int(iH*0.55), iW, int(iH*0.55),int(0.1*iH), 255, 255, 255)
|
||||
hyperion.imageDrawLine(0, int(iH*0.75), iW, int(iH*0.75),int(0.1*iH), 255, 255, 255)
|
||||
hyperion.imageDrawLine(int(0.175*iW), 0, int(0.175*iW), int(iH*0.35),int(0.1*iH), 255, 255, 255)
|
||||
hyperion.imageDrawLine(0, int(0.175*iW), int(iH*0.35), int(0.175*iW),int(0.1*iH), 255, 255, 255)
|
||||
|
||||
#############
|
||||
# other flags
|
||||
#############
|
||||
|
||||
# ch flag (Swiss)
|
||||
if country == "ch":
|
||||
hyperion.imageSolidFill(255, 0, 0)
|
||||
hyperion.imageDrawLine(int(iW*0.5), int(iH*0.25), int(iW*0.5), int(iH*0.75), int(iH*0.15), 255, 255, 255)
|
||||
hyperion.imageDrawLine(int(iW*0.26), int(iH*0.5), int(iW*0.75), int(iH*0.5), int(iH*0.15), 255, 255, 255)
|
||||
|
||||
#prepare wanted flags
|
||||
for cf in countries:
|
||||
printFlag(cf)
|
||||
imgIds.append(hyperion.imageSave())
|
||||
hyperion.imageSolidFill(0, 0, 0)
|
||||
|
||||
while not hyperion.abort():
|
||||
switchImage()
|
||||
time.sleep(duration)
|
@@ -3,6 +3,14 @@
|
||||
"script" : "light-clock.py",
|
||||
"args" :
|
||||
{
|
||||
"show_seconds" : true
|
||||
"show_seconds" : true,
|
||||
"marker-enabled" : false,
|
||||
"hour-color" : [0,0,255],
|
||||
"minute-color" : [0,255,0],
|
||||
"second-color" : [255,0,0],
|
||||
"background-color" : [0,0,0],
|
||||
"marker-depth" : 0,
|
||||
"marker-width" : 5,
|
||||
"marker-color" : [255,255,255]
|
||||
}
|
||||
}
|
||||
|
@@ -1,35 +1,46 @@
|
||||
import hyperion, time, datetime
|
||||
|
||||
hyperion.imageMinSize(32,32)
|
||||
|
||||
# Get the parameters
|
||||
showSeconds = bool(hyperion.args.get('show_seconds', True))
|
||||
centerX = int(round(hyperion.imageWidth())/2)
|
||||
centerY = int(round(float(hyperion.imageHeight())/2))
|
||||
showSec = bool(hyperion.args.get('show_seconds', True))
|
||||
hC = hyperion.args.get('hour-color', (0,0,255))
|
||||
mC = hyperion.args.get('minute-color', (0,255,0))
|
||||
sC = hyperion.args.get('second-color', (255,0,0))
|
||||
bgC = hyperion.args.get('background-color', (0,0,0))
|
||||
markEnable = hyperion.args.get('marker-enabled', False)
|
||||
markD = int(hyperion.args.get('marker-depth', 5))/100.0
|
||||
markW = int(hyperion.args.get('marker-width', 5))/100.0
|
||||
markC = hyperion.args.get('marker-color', (255,255,255))
|
||||
|
||||
|
||||
#calculate some stuff
|
||||
centerX = int(round(hyperion.imageWidth())/2)
|
||||
centerY = int(round(float(hyperion.imageHeight())/2))
|
||||
markDepthX = int(round(hyperion.imageWidth()*markD))
|
||||
markDepthY = int(round(hyperion.imageHeight()*markD))
|
||||
markThick = int(round(hyperion.imageHeight()*markW))
|
||||
|
||||
colorsSecond = bytearray([
|
||||
0, 255,255,0,255,
|
||||
5, 255,255,0,255,
|
||||
30, 0,0,0,0,
|
||||
0, sC[0],sC[1],sC[2],255,
|
||||
8, sC[0],sC[1],sC[2],255,
|
||||
10, 0,0,0,0,
|
||||
])
|
||||
|
||||
colorsMinute = bytearray([
|
||||
0, 0,255,0,255,
|
||||
5, 0,255,0,250,
|
||||
0, mC[0],mC[1],mC[2],255,
|
||||
35, mC[0],mC[1],mC[2],255,
|
||||
50, mC[0],mC[1],mC[2],127,
|
||||
90, 0,0,0,0,
|
||||
|
||||
])
|
||||
|
||||
colorsHour = bytearray([
|
||||
0, 0,0,255,255,
|
||||
10, 0,0,255,255,
|
||||
127, 0,0,196,127,
|
||||
255, 0,0,196,5,
|
||||
0, hC[0],hC[1],hC[2],255,
|
||||
90, hC[0],hC[1],hC[2],255,
|
||||
150, hC[0],hC[1],hC[2],127,
|
||||
191, 0,0,0,0,
|
||||
])
|
||||
|
||||
colorsHourTop = bytearray([
|
||||
0, 0,0,255,250,
|
||||
10, 0,0,255,128,
|
||||
20, 0,0,0,0,
|
||||
])
|
||||
|
||||
# effect loop
|
||||
while not hyperion.abort():
|
||||
@@ -38,17 +49,30 @@ while not hyperion.abort():
|
||||
angleH = 449 - 30*(now.hour if now.hour<12 else now.hour-12)
|
||||
angleM = 449 - 6*now.minute
|
||||
angleS = 449 - 6*now.second
|
||||
|
||||
|
||||
angleH -= 0 if angleH<360 else 360
|
||||
angleM -= 0 if angleM<360 else 360
|
||||
angleS -= 0 if angleS<360 else 360
|
||||
|
||||
hyperion.imageSolidFill(127,127,127);
|
||||
hyperion.imageCanonicalGradient(centerX, centerY, angleH, colorsHour)
|
||||
hyperion.imageCanonicalGradient(centerX, centerY, angleM, colorsMinute)
|
||||
hyperion.imageCanonicalGradient(centerX, centerY, angleH, colorsHourTop)
|
||||
if showSeconds:
|
||||
hyperion.imageCanonicalGradient(centerX, centerY, angleS, colorsSecond)
|
||||
#reset image
|
||||
hyperion.imageSolidFill(bgC[0],bgC[1],bgC[2])
|
||||
|
||||
#paint clock
|
||||
if angleH-angleM < 90 and angleH-angleM > 0:
|
||||
hyperion.imageConicalGradient(centerX, centerY, angleM, colorsMinute)
|
||||
hyperion.imageConicalGradient(centerX, centerY, angleH, colorsHour)
|
||||
else:
|
||||
hyperion.imageConicalGradient(centerX, centerY, angleH, colorsHour)
|
||||
hyperion.imageConicalGradient(centerX, centerY, angleM, colorsMinute)
|
||||
|
||||
if showSec:
|
||||
hyperion.imageConicalGradient(centerX, centerY, angleS, colorsSecond)
|
||||
if markEnable:
|
||||
#marker left, right, top, bottom
|
||||
hyperion.imageDrawLine(0, centerY, 0+markDepthX, centerY, markThick, markC[0], markC[1], markC[2])
|
||||
hyperion.imageDrawLine(int(hyperion.imageWidth()), centerY, int(hyperion.imageWidth())-markDepthX, centerY, markThick, markC[0], markC[1], markC[2])
|
||||
hyperion.imageDrawLine(centerX, 0, centerX, 0+markDepthY, markThick, markC[0], markC[1], markC[2])
|
||||
hyperion.imageDrawLine(centerX, int(hyperion.imageHeight()), centerX, int(hyperion.imageHeight())-markDepthY, markThick, markC[0], markC[1], markC[2])
|
||||
|
||||
hyperion.imageShow()
|
||||
time.sleep(0.5 )
|
||||
time.sleep(0.5)
|
@@ -1,11 +1,15 @@
|
||||
{
|
||||
"name" : "Rainbow swirl fast",
|
||||
"script" : "rainbow-swirl.py",
|
||||
"script" : "swirl.py",
|
||||
"args" :
|
||||
{
|
||||
"rotation-time" : 4.0,
|
||||
"rotation-time" : 7.0,
|
||||
"center_x" : 0.5,
|
||||
"center_y" : 0.5,
|
||||
"reverse" : false
|
||||
"reverse" : false,
|
||||
"custom-colors":[],
|
||||
"random-center":false,
|
||||
"custom-colors2":[],
|
||||
"enable-second":false
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,15 @@
|
||||
{
|
||||
"name" : "Rainbow swirl",
|
||||
"script" : "rainbow-swirl.py",
|
||||
"script" : "swirl.py",
|
||||
"args" :
|
||||
{
|
||||
"rotation-time" : 20.0,
|
||||
"center_x" : 0.5,
|
||||
"center_y" : 0.5,
|
||||
"reverse" : false
|
||||
"reverse" : false,
|
||||
"custom-colors":[],
|
||||
"random-center":false,
|
||||
"custom-colors2":[],
|
||||
"enable-second":false
|
||||
}
|
||||
}
|
||||
|
@@ -1,53 +0,0 @@
|
||||
import hyperion, time, math
|
||||
|
||||
# set minimum image size - must be done asap
|
||||
hyperion.imageMinSize(32,32)
|
||||
|
||||
# Get the parameters
|
||||
rotationTime = float(hyperion.args.get('rotation-time', 3.0))
|
||||
reverse = bool(hyperion.args.get('reverse', False))
|
||||
centerX = float(hyperion.args.get('center_x', 0.5))
|
||||
centerY = float(hyperion.args.get('center_y', 0.5))
|
||||
|
||||
minStepTime = float(hyperion.latchTime)/1000.0
|
||||
sleepTime = max(0.1, rotationTime) / 360
|
||||
angle = 0
|
||||
centerX = int(round(float(hyperion.imageWidth())*centerX))
|
||||
centerY = int(round(float(hyperion.imageHeight())*centerY))
|
||||
increment = -1 if reverse else 1
|
||||
|
||||
# adapt sleeptime to hardware
|
||||
if minStepTime > sleepTime:
|
||||
increment *= int(math.ceil(minStepTime / sleepTime))
|
||||
sleepTime = minStepTime
|
||||
|
||||
# table of stop colors for rainbow gradient, first is the position, next rgb, all values 0-255
|
||||
rainbowColors = bytearray([
|
||||
0 ,255,0 ,0, 255,
|
||||
25 ,255,230,0, 255,
|
||||
63 ,255,255,0, 255,
|
||||
100,0 ,255,0, 255,
|
||||
127,0 ,255,200, 255,
|
||||
159,0 ,255,255, 255,
|
||||
191,0 ,0 ,255, 255,
|
||||
224,255,0 ,255, 255,
|
||||
255,255,0 ,127, 255,
|
||||
#0, 255, 0, 0, 255,
|
||||
#42, 255, 255, 0, 255,
|
||||
#85, 0, 255, 0, 255,
|
||||
#128, 0, 255, 255, 255,
|
||||
#170, 0, 0, 255, 255,
|
||||
#212, 255, 0, 255, 255,
|
||||
#255, 255, 0, 0, 255,
|
||||
])
|
||||
|
||||
# effect loop
|
||||
while not hyperion.abort():
|
||||
angle += increment
|
||||
if angle > 360: angle=0
|
||||
if angle < 0: angle=360
|
||||
|
||||
hyperion.imageCanonicalGradient(centerX, centerY, angle, rainbowColors)
|
||||
|
||||
hyperion.imageShow()
|
||||
time.sleep(sleepTime)
|
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "candle.py",
|
||||
"title":"edt_eff_candle_header_title",
|
||||
"title":"edt_eff_candle_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"candles": {
|
||||
"type": "string",
|
||||
"title":"edt_eff_whichleds_title",
|
||||
"title":"edt_eff_whichleds",
|
||||
"enum" : ["all","all-together","list"],
|
||||
"default" : "all",
|
||||
"options" : {
|
||||
@@ -16,13 +16,18 @@
|
||||
},
|
||||
"ledlist": {
|
||||
"type": "string",
|
||||
"title":"edt_eff_ledlist_title",
|
||||
"title":"edt_eff_ledlist",
|
||||
"default" : "1,11,21",
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"candles": "list"
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 2
|
||||
},
|
||||
"color": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_color_title",
|
||||
"title":"edt_eff_color",
|
||||
"format":"colorpicker",
|
||||
"default": [255,138,0],
|
||||
"items" : {
|
||||
@@ -35,8 +40,8 @@
|
||||
"propertyOrder" : 3
|
||||
},
|
||||
"colorShift": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_colorshift_title",
|
||||
"type": "integer",
|
||||
"title":"edt_eff_colorshift",
|
||||
"default": 1,
|
||||
"minimum" : 0,
|
||||
"maximum": 30,
|
||||
@@ -44,8 +49,8 @@
|
||||
"propertyOrder" : 4
|
||||
},
|
||||
"brightness": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_brightness_title",
|
||||
"type": "integer",
|
||||
"title":"edt_eff_brightness",
|
||||
"default": 100,
|
||||
"minimum" : 1,
|
||||
"maximum": 100,
|
||||
@@ -55,7 +60,7 @@
|
||||
},
|
||||
"sleepTime": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_sleeptime_title",
|
||||
"title":"edt_eff_sleeptime",
|
||||
"default": 0.15,
|
||||
"minimum" : 0.01,
|
||||
"maximum": 1,
|
||||
|
@@ -1,90 +0,0 @@
|
||||
{
|
||||
"type": "object",
|
||||
"script": "clock.py",
|
||||
"title": "edt_eff_clock_header_title",
|
||||
"required": true,
|
||||
"properties": {
|
||||
"offset": {
|
||||
"type": "integer",
|
||||
"title": "edt_eff_offset_title",
|
||||
"default": 0,
|
||||
"append": "edt_append_leds",
|
||||
"propertyOrder": 1
|
||||
},
|
||||
"hour-color": {
|
||||
"type": "array",
|
||||
"title": "edt_eff_colorHour_title",
|
||||
"format": "colorpicker",
|
||||
"default": [255, 0, 0],
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder": 2
|
||||
},
|
||||
"minute-color": {
|
||||
"type": "array",
|
||||
"title": "edt_eff_colorMinute_title",
|
||||
"format": "colorpicker",
|
||||
"default": [0, 255, 0],
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder": 3
|
||||
},
|
||||
"second-color": {
|
||||
"type": "array",
|
||||
"title": "edt_eff_colorSecond_title",
|
||||
"format": "colorpicker",
|
||||
"default": [0, 0, 255],
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder": 4
|
||||
},
|
||||
"hour-margin": {
|
||||
"type": "integer",
|
||||
"title": "edt_eff_hourMargin_title",
|
||||
"default": 2,
|
||||
"propertyOrder" : 5
|
||||
},
|
||||
"minute-margin": {
|
||||
"type": "integer",
|
||||
"title": "edt_eff_minuteMargin_title",
|
||||
"default": 1,
|
||||
"propertyOrder" : 6
|
||||
},
|
||||
"second-margin": {
|
||||
"type": "integer",
|
||||
"title": "edt_eff_secondMargin_title",
|
||||
"default": 0,
|
||||
"propertyOrder" : 7
|
||||
},
|
||||
"marker-color": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_colorMarker_title",
|
||||
"format":"colorpicker",
|
||||
"default": [255,255,255],
|
||||
"items" : {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder" : 8
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "fade.py",
|
||||
"title":"edt_eff_fade_header_title",
|
||||
"title":"edt_eff_fade_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"color-start": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_colorstart_title",
|
||||
"title":"edt_eff_colorstart",
|
||||
"format":"colorpicker",
|
||||
"default": [255,174,11],
|
||||
"items" : {
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"color-start-time": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_colorstarttime_title",
|
||||
"title":"edt_eff_colorstarttime",
|
||||
"default": 1000,
|
||||
"minimum" : 0,
|
||||
"append" : "edt_append_ms",
|
||||
@@ -29,7 +29,7 @@
|
||||
},
|
||||
"fade-in-time": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_fadeintime_title",
|
||||
"title":"edt_eff_fadeintime",
|
||||
"default": 2000,
|
||||
"minimum" : 0,
|
||||
"append" : "edt_append_ms",
|
||||
@@ -37,7 +37,7 @@
|
||||
},
|
||||
"color-end": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_colorend_title",
|
||||
"title":"edt_eff_colorend",
|
||||
"format":"colorpicker",
|
||||
"default": [100,100,100],
|
||||
"items" : {
|
||||
@@ -51,7 +51,7 @@
|
||||
},
|
||||
"color-end-time": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_colorendtime_title",
|
||||
"title":"edt_eff_colorendtime",
|
||||
"default": 1000,
|
||||
"minimum" : 0,
|
||||
"append" : "edt_append_ms",
|
||||
@@ -59,7 +59,7 @@
|
||||
},
|
||||
"fade-out-time": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_fadeouttime_title",
|
||||
"title":"edt_eff_fadeouttime",
|
||||
"default": 2000,
|
||||
"minimum" : 0,
|
||||
"append" : "edt_append_ms",
|
||||
@@ -67,13 +67,13 @@
|
||||
},
|
||||
"repeat-count": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_repeatcount_title",
|
||||
"title":"edt_eff_repeatcount",
|
||||
"default": 0,
|
||||
"propertyOrder" : 7
|
||||
},
|
||||
"maintain-end-color": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_maintain_end_color_title",
|
||||
"title":"edt_eff_maintain_end_color",
|
||||
"default": true,
|
||||
"propertyOrder" : 8
|
||||
}
|
||||
|
27
effects/schema/flag.schema.json
Normal file
27
effects/schema/flag.schema.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "flag.py",
|
||||
"title":"edt_eff_flag_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"countries": {
|
||||
"type": "array",
|
||||
"title" : "edt_eff_countries",
|
||||
"uniqueItems": true,
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": ["de","at","fr","be","it","es","bg","ee","dk","fi","hu","ie","lv","lt","lu","mt","nl","pl","pt","ro","sl","se","ch"]
|
||||
},
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"switch-time": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_interval",
|
||||
"default": 5,
|
||||
"minimum" : 1,
|
||||
"append" : "edt_append_s",
|
||||
"propertyOrder" : 2
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "knight-rider.py",
|
||||
"title":"edt_eff_knightrider_header_title",
|
||||
"title":"edt_eff_knightrider_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"color": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_color_title",
|
||||
"title":"edt_eff_color",
|
||||
"format":"colorpicker",
|
||||
"default": [255,0,0],
|
||||
"items" : {
|
||||
@@ -20,7 +20,7 @@
|
||||
},
|
||||
"speed": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_speed_title",
|
||||
"title":"edt_eff_speed",
|
||||
"default": 1.0,
|
||||
"minimum": 0.1,
|
||||
"step" : 0.1,
|
||||
@@ -28,7 +28,7 @@
|
||||
},
|
||||
"fadeFactor": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_fadefactor_title",
|
||||
"title":"edt_eff_fadefactor",
|
||||
"default": 0.7,
|
||||
"minimum" : 0.0,
|
||||
"maximum" : 0.9,
|
||||
|
@@ -1,14 +1,123 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "light-clock.py",
|
||||
"title":"edt_eff_lightclock_header_title",
|
||||
"title":"edt_eff_lightclock_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"hour-color": {
|
||||
"type": "array",
|
||||
"title": "edt_eff_colorHour",
|
||||
"format": "colorpicker",
|
||||
"default": [0, 0, 255],
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder": 1
|
||||
},
|
||||
"minute-color": {
|
||||
"type": "array",
|
||||
"title": "edt_eff_colorMinute",
|
||||
"format": "colorpicker",
|
||||
"default": [0, 255, 0],
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder": 2
|
||||
},
|
||||
"second-color": {
|
||||
"type": "array",
|
||||
"title": "edt_eff_colorSecond",
|
||||
"format": "colorpicker",
|
||||
"default": [255, 0, 0],
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder": 3
|
||||
},
|
||||
"background-color": {
|
||||
"type": "array",
|
||||
"title": "edt_eff_backgroundColor",
|
||||
"format": "colorpicker",
|
||||
"default": [0, 0, 0],
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder": 4
|
||||
},
|
||||
"show_seconds": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_showseconds_title",
|
||||
"title":"edt_eff_showseconds",
|
||||
"default": true,
|
||||
"propertyOrder" : 1
|
||||
"propertyOrder" : 5
|
||||
},
|
||||
"marker-enabled": {
|
||||
"type": "boolean",
|
||||
"title": "edt_eff_markerEnable",
|
||||
"default": false,
|
||||
"propertyOrder" : 6
|
||||
},
|
||||
"marker-depth": {
|
||||
"type": "integer",
|
||||
"title": "edt_eff_markerDepth",
|
||||
"default": 5,
|
||||
"minimum" : 1,
|
||||
"maximum" : 50,
|
||||
"append" : "edt_append_percent",
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"marker-enabled": true
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 7
|
||||
},
|
||||
"marker-width": {
|
||||
"type": "integer",
|
||||
"title": "edt_eff_markerWidth",
|
||||
"default": 5,
|
||||
"minimum" : 1,
|
||||
"maximum" : 25,
|
||||
"append" : "edt_append_percent",
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"marker-enabled": true
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 8
|
||||
},
|
||||
"marker-color": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_colorMarker",
|
||||
"format":"colorpicker",
|
||||
"default": [255,255,255],
|
||||
"items" : {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"marker-enabled": true
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 9
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "mood-blobs.py",
|
||||
"title":"edt_eff_moodblobs_header_title",
|
||||
"title":"edt_eff_moodblobs_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"color": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_color_title",
|
||||
"title":"edt_eff_color",
|
||||
"format":"colorpicker",
|
||||
"default": [255,0,0],
|
||||
"items" : {
|
||||
@@ -20,14 +20,14 @@
|
||||
},
|
||||
"blobs": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_blobcount_title",
|
||||
"title":"edt_eff_blobcount",
|
||||
"default": 5,
|
||||
"minimum" : 1,
|
||||
"propertyOrder" : 2
|
||||
},
|
||||
"rotationTime": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_rotationtime_title",
|
||||
"title":"edt_eff_rotationtime",
|
||||
"default": 20.0,
|
||||
"minimum" : 1.0,
|
||||
"append" : "edt_append_s",
|
||||
@@ -35,53 +35,68 @@
|
||||
},
|
||||
"hueChange": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_huechange_title",
|
||||
"title":"edt_eff_huechange",
|
||||
"default": 60.0,
|
||||
"minimum" : 1.0,
|
||||
"propertyOrder" : 4
|
||||
},
|
||||
"reverse": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_reversedirection_title",
|
||||
"title":"edt_eff_reversedirection",
|
||||
"default": false,
|
||||
"propertyOrder" : 5
|
||||
},
|
||||
"colorRandom": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_colorrandom_title",
|
||||
"title":"edt_eff_colorrandom",
|
||||
"default": false,
|
||||
"propertyOrder" : 6
|
||||
},
|
||||
"baseChange": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_basecolorchange_title",
|
||||
"title":"edt_eff_basecolorchange",
|
||||
"default": false,
|
||||
"propertyOrder" : 7
|
||||
},
|
||||
"baseColorRangeLeft": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_basecolorrangeleft_title",
|
||||
"title":"edt_eff_basecolorrangeleft",
|
||||
"default": 0.0,
|
||||
"minimum" : 0.0,
|
||||
"maximum" : 360.0,
|
||||
"append" : "edt_append_degree",
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"baseChange": true
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 9
|
||||
},
|
||||
"baseColorRangeRight": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_basecolorrangeright_title",
|
||||
"title":"edt_eff_basecolorrangeright",
|
||||
"default": 360.0,
|
||||
"minimum" : 0.0,
|
||||
"maximum" : 360.0,
|
||||
"append" : "edt_append_degree",
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"baseChange": true
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 10
|
||||
},
|
||||
"baseColorChangeRate": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_basecolorchangerate_title",
|
||||
"title":"edt_eff_basecolorchangerate",
|
||||
"default": 2.0,
|
||||
"minimum" : 0.0,
|
||||
"append" : "edt_append_sdegree",
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"baseChange": true
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 8
|
||||
}
|
||||
},
|
||||
|
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "pacman.py",
|
||||
"title":"edt_eff_pacman_header_title",
|
||||
"title":"edt_eff_pacman_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"rotationTime": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_rotationtime_title",
|
||||
"title":"edt_eff_rotationtime",
|
||||
"default": 5,
|
||||
"step" : 0.1,
|
||||
"minimum": 1,
|
||||
@@ -15,7 +15,7 @@
|
||||
},
|
||||
"margin-pos": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_margin_title",
|
||||
"title":"edt_eff_margin",
|
||||
"default": 1.0,
|
||||
"step" : 0.1,
|
||||
"minimum": 1.0,
|
||||
|
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "police.py",
|
||||
"title":"edt_eff_police_header_title",
|
||||
"title":"edt_eff_police_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"color_one": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_colorone_title",
|
||||
"title":"edt_eff_colorone",
|
||||
"format":"colorpicker",
|
||||
"default": [255,0,0],
|
||||
"items" : {
|
||||
@@ -20,7 +20,7 @@
|
||||
},
|
||||
"color_two": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_colortwo_title",
|
||||
"title":"edt_eff_colortwo",
|
||||
"format":"colorpicker",
|
||||
"default": [0,0,255],
|
||||
"items" : {
|
||||
@@ -34,14 +34,14 @@
|
||||
},
|
||||
"colors_count": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_colorcount_title",
|
||||
"title":"edt_eff_colorcount",
|
||||
"default": 10,
|
||||
"minimum" : 0,
|
||||
"propertyOrder" : 3
|
||||
},
|
||||
"rotation-time": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_rotationtime_title",
|
||||
"title":"edt_eff_rotationtime",
|
||||
"default": 2.0,
|
||||
"minimum" : 0.1,
|
||||
"append" : "edt_append_s",
|
||||
@@ -49,7 +49,7 @@
|
||||
},
|
||||
"reverse": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_reversedirection_title",
|
||||
"title":"edt_eff_reversedirection",
|
||||
"default": false,
|
||||
"propertyOrder" : 5
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "rainbow-mood.py",
|
||||
"title":"edt_eff_rainbowmood_header_title",
|
||||
"title":"edt_eff_rainbowmood_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"rotation-time": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_rotationtime_title",
|
||||
"title":"edt_eff_rotationtime",
|
||||
"default": 60.0,
|
||||
"minimum" : 1.0,
|
||||
"append" : "edt_append_s",
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
"brightness": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_brightness_title",
|
||||
"title":"edt_eff_brightness",
|
||||
"default": 100,
|
||||
"minimum" : 1,
|
||||
"maximum" : 100,
|
||||
@@ -24,7 +24,7 @@
|
||||
},
|
||||
"saturation": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_saturation_title",
|
||||
"title":"edt_eff_saturation",
|
||||
"default": 100,
|
||||
"minimum" : 1,
|
||||
"maximum" : 100,
|
||||
@@ -34,7 +34,7 @@
|
||||
},
|
||||
"reverse": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_reversedirection_title",
|
||||
"title":"edt_eff_reversedirection",
|
||||
"default": false,
|
||||
"propertyOrder" : 4
|
||||
}
|
||||
|
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "rainbow-swirl.py",
|
||||
"title":"edt_eff_rainbowswirl_header_title",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"rotation-time": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_rotationtime_title",
|
||||
"default": 10.0,
|
||||
"minimum" : 0.1,
|
||||
"append" : "edt_append_s",
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"center_x": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_centerx_title",
|
||||
"default": 0.5,
|
||||
"minimum" : 0.0,
|
||||
"maximum" : 2.0,
|
||||
"step" : 0.1,
|
||||
"propertyOrder" : 2
|
||||
},
|
||||
"center_y": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_centery_title",
|
||||
"default": 0.5,
|
||||
"minimum" : 0.0,
|
||||
"maximum" : 2.0,
|
||||
"step" : 0.1,
|
||||
"propertyOrder" : 3
|
||||
},
|
||||
"reverse": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_reversedirection_title",
|
||||
"default": false,
|
||||
"propertyOrder" : 4
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "random.py",
|
||||
"title":"edt_eff_random_header_title",
|
||||
"title":"edt_eff_random_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"speed": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_speed_title",
|
||||
"title":"edt_eff_speed",
|
||||
"default": 1000,
|
||||
"minimum" : 10,
|
||||
"append" : "edt_append_ms",
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
"saturation": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_saturation_title",
|
||||
"title":"edt_eff_saturation",
|
||||
"default": 1.0,
|
||||
"minimum" : 0.1,
|
||||
"maximum" : 1.0,
|
||||
|
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "running_dots.py",
|
||||
"title":"edt_eff_runningdots_header_title",
|
||||
"title":"edt_eff_runningdots_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"speed": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_speed_title",
|
||||
"title":"edt_eff_speed",
|
||||
"default": 1.5,
|
||||
"minimum" : 0.1,
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"colorLevel": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_colorevel_title",
|
||||
"title":"edt_eff_colorevel",
|
||||
"default": 220,
|
||||
"minimium" : 0,
|
||||
"maximum" : 255,
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"whiteLevel": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_whitelevel_title",
|
||||
"title":"edt_eff_whitelevel",
|
||||
"default": 0,
|
||||
"minimium" : 0,
|
||||
"maximum" : 254,
|
||||
|
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "shutdown.py",
|
||||
"title":"edt_eff_systemshutdown_header_title",
|
||||
"title":"edt_eff_systemshutdown_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"speed": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_speed_title",
|
||||
"title":"edt_eff_speed",
|
||||
"default": 1.0,
|
||||
"minimum" : 0.3,
|
||||
"step" : 0.1,
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
"alarm-color": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_alarmcolor_title",
|
||||
"title":"edt_eff_alarmcolor",
|
||||
"format":"colorpicker",
|
||||
"default": [255,0,0],
|
||||
"items" : {
|
||||
@@ -28,7 +28,7 @@
|
||||
},
|
||||
"post-color": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_postcolor_title",
|
||||
"title":"edt_eff_postcolor",
|
||||
"format" : "colorpicker",
|
||||
"default": [255,174,11],
|
||||
"items" : {
|
||||
@@ -42,19 +42,19 @@
|
||||
},
|
||||
"initial-blink": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_initial_blink_title",
|
||||
"title":"edt_eff_initial_blink",
|
||||
"default": true,
|
||||
"propertyOrder" : 4
|
||||
},
|
||||
"set-post-color": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_set_post_color_title",
|
||||
"title":"edt_eff_set_post_color",
|
||||
"default": true,
|
||||
"propertyOrder" : 5
|
||||
},
|
||||
"shutdown-enabled": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_enableshutdown_title",
|
||||
"title":"edt_eff_enableshutdown",
|
||||
"default": false,
|
||||
"propertyOrder" : 6
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "snake.py",
|
||||
"title":"edt_eff_snake_header_title",
|
||||
"title":"edt_eff_snake_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"color": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_color_title",
|
||||
"title":"edt_eff_color",
|
||||
"format":"colorpicker",
|
||||
"default": [255,0,0],
|
||||
"items" : {
|
||||
@@ -20,7 +20,7 @@
|
||||
},
|
||||
"rotation-time": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_rotationtime_title",
|
||||
"title":"edt_eff_rotationtime",
|
||||
"default": 12.0,
|
||||
"minimum" : 0.1,
|
||||
"append" : "edt_append_s",
|
||||
@@ -28,7 +28,7 @@
|
||||
},
|
||||
"percentage": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_length_title",
|
||||
"title":"edt_eff_length",
|
||||
"default": 10,
|
||||
"append" : "edt_append_percent",
|
||||
"propertyOrder" : 3
|
||||
|
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "sparks.py",
|
||||
"title":"edt_eff_sparks_header_title",
|
||||
"title":"edt_eff_sparks_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"color": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_color_title",
|
||||
"title":"edt_eff_color",
|
||||
"format":"colorpicker",
|
||||
"default": [255,0,0],
|
||||
"items" : {
|
||||
@@ -16,11 +16,16 @@
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"random-color": false
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"rotation-time": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_rotationtime_title",
|
||||
"title":"edt_eff_rotationtime",
|
||||
"default": 2.0,
|
||||
"minimum" : 0.1,
|
||||
"append" : "edt_append_s",
|
||||
@@ -28,40 +33,36 @@
|
||||
},
|
||||
"sleep-time": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_sleeptime_title",
|
||||
"title":"edt_eff_sleeptime",
|
||||
"default": 0.05,
|
||||
"minimum" : 0.01,
|
||||
"propertyOrder" : 3
|
||||
},
|
||||
"brightness": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_brightness_title",
|
||||
"type": "integer",
|
||||
"title":"edt_eff_brightness",
|
||||
"default": 100,
|
||||
"minimum" : 1,
|
||||
"minimum" : 0,
|
||||
"maximum" : 100,
|
||||
"step" : 10,
|
||||
"append" : "edt_append_percent",
|
||||
"propertyOrder" : 4
|
||||
},
|
||||
"saturation": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_saturation_title",
|
||||
"type": "integer",
|
||||
"title":"edt_eff_saturation",
|
||||
"default": 100,
|
||||
"minimum" : 1,
|
||||
"minimum" : 0,
|
||||
"maximum" : 100,
|
||||
"step" : 10,
|
||||
"append" : "edt_append_percent",
|
||||
"propertyOrder" : 5
|
||||
},
|
||||
"reverse": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_reversedirection_title",
|
||||
"default": false,
|
||||
"propertyOrder" : 6
|
||||
},
|
||||
"random-color": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_colorrandom_title",
|
||||
"title":"edt_eff_colorrandom",
|
||||
"default": false,
|
||||
"propertyOrder" : 7
|
||||
"propertyOrder" : 6
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
151
effects/schema/swirl.schema.json
Normal file
151
effects/schema/swirl.schema.json
Normal file
@@ -0,0 +1,151 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "swirl.py",
|
||||
"title":"edt_eff_swirl_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"rotation-time": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_rotationtime",
|
||||
"default": 10.0,
|
||||
"minimum" : 0.1,
|
||||
"append" : "edt_append_s",
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"random-center": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_randomCenter",
|
||||
"default": false,
|
||||
"propertyOrder" : 2
|
||||
},
|
||||
"center_x": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_centerx",
|
||||
"default": 0.5,
|
||||
"minimum" : 0.0,
|
||||
"maximum" : 2.0,
|
||||
"step" : 0.1,
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"random-center": false
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 3
|
||||
},
|
||||
"center_y": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_centery",
|
||||
"default": 0.5,
|
||||
"minimum" : 0.0,
|
||||
"maximum" : 2.0,
|
||||
"step" : 0.1,
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"random-center": false
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 4
|
||||
},
|
||||
"reverse": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_reversedirection",
|
||||
"default": false,
|
||||
"propertyOrder" : 5
|
||||
},
|
||||
"custom-colors": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_customColor",
|
||||
"items" : {
|
||||
"type": "array",
|
||||
"title" : "edt_eff_color",
|
||||
"format":"colorpicker",
|
||||
"default" : [255,0,0],
|
||||
"items":{
|
||||
"type":"integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3
|
||||
},
|
||||
"propertyOrder" : 6
|
||||
},
|
||||
"enable-second": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_enableSecondSwirl",
|
||||
"default": false,
|
||||
"propertyOrder" : 7
|
||||
},
|
||||
"random-center2": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_randomCenter",
|
||||
"default": false,
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"enable-second": true
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 8
|
||||
},
|
||||
"center_x2": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_centerx",
|
||||
"default": 0.5,
|
||||
"minimum" : 0.0,
|
||||
"maximum" : 2.0,
|
||||
"step" : 0.1,
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"enable-second": true,
|
||||
"random-center2": false
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 9
|
||||
},
|
||||
"center_y2": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_centery",
|
||||
"default": 0.5,
|
||||
"minimum" : 0.0,
|
||||
"maximum" : 2.0,
|
||||
"step" : 0.1,
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"enable-second": true,
|
||||
"random-center2": false
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 10
|
||||
},
|
||||
"reverse2": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_reversedirection",
|
||||
"default": true,
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"enable-second": true
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 11
|
||||
},
|
||||
"custom-colors2": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_customColor",
|
||||
"items" : {
|
||||
"type": "array",
|
||||
"title" : "edt_eff_color",
|
||||
"format":"colorpickerRGBA",
|
||||
"default" : [255,0,0,0.5],
|
||||
"minItems": 4,
|
||||
"maxItems": 4
|
||||
},
|
||||
"options": {
|
||||
"dependencies": {
|
||||
"enable-second": true
|
||||
}
|
||||
},
|
||||
"propertyOrder" : 12
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "traces.py",
|
||||
"title":"edt_eff_traces_header_title",
|
||||
"title":"edt_eff_traces_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"speed": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_speed_title",
|
||||
"title":"edt_eff_speed",
|
||||
"default": 1.0,
|
||||
"minimum" : 0.1,
|
||||
"propertyOrder" : 1
|
||||
|
@@ -1,40 +1,40 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "trails.py",
|
||||
"title":"edt_eff_trails_header_title",
|
||||
"title":"edt_eff_trails_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"min_len": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_min_len_title",
|
||||
"title":"edt_eff_min_len",
|
||||
"default": 2,
|
||||
"minimum" : 1,
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"max_len": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_max_len_title",
|
||||
"title":"edt_eff_max_len",
|
||||
"default": 7,
|
||||
"minimum" : 1,
|
||||
"propertyOrder" : 2
|
||||
},
|
||||
"height": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_height_title",
|
||||
"title":"edt_eff_height",
|
||||
"default": 8,
|
||||
"minimum" : 1,
|
||||
"propertyOrder" : 3
|
||||
},
|
||||
"trails": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_count_title",
|
||||
"title":"edt_eff_count",
|
||||
"default": 3,
|
||||
"minimum" : 1,
|
||||
"propertyOrder" : 4
|
||||
},
|
||||
"speed": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_speed_title",
|
||||
"title":"edt_eff_speed",
|
||||
"default": 100,
|
||||
"minimum" : 10,
|
||||
"append" : "edt_append_ms",
|
||||
@@ -42,13 +42,13 @@
|
||||
},
|
||||
"random": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_colorrandom_title",
|
||||
"title":"edt_eff_colorrandom",
|
||||
"default": false,
|
||||
"propertyOrder" : 6
|
||||
},
|
||||
"color": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_color_title",
|
||||
"title":"edt_eff_color",
|
||||
"format":"colorpicker",
|
||||
"default": [255,0,0],
|
||||
"items" : {
|
||||
|
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "x-mas.py",
|
||||
"title":"edt_eff_x-mas_header_title",
|
||||
"title":"edt_eff_x-mas_header",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"sleepTime": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_sleeptime_title",
|
||||
"title":"edt_eff_sleeptime",
|
||||
"default": 1000,
|
||||
"minimum" : 100,
|
||||
"append" : "edt_append_ms",
|
||||
@@ -14,14 +14,14 @@
|
||||
},
|
||||
"length": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_length_title",
|
||||
"title":"edt_eff_length",
|
||||
"default": 1,
|
||||
"minimum" : 1,
|
||||
"propertyOrder" : 2
|
||||
},
|
||||
"color1": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_color_title",
|
||||
"title":"edt_eff_color",
|
||||
"format":"colorpicker",
|
||||
"default": [255,255,255],
|
||||
"items" : {
|
||||
@@ -35,7 +35,7 @@
|
||||
},
|
||||
"color2": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_color_title",
|
||||
"title":"edt_eff_color",
|
||||
"format":"colorpicker",
|
||||
"default": [255,0,0],
|
||||
"items" : {
|
||||
|
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"name" : "Sparks Color",
|
||||
"script" : "sparks.py",
|
||||
"args" :
|
||||
{
|
||||
"rotation-time" : 3.0,
|
||||
"sleep-time" : 0.05,
|
||||
"brightness" : 1.0,
|
||||
"saturation" : 1.0,
|
||||
"reverse" : false,
|
||||
"color" : [255,255,255],
|
||||
"random-color" : true
|
||||
}
|
||||
}
|
@@ -7,7 +7,6 @@
|
||||
"sleep-time" : 0.05,
|
||||
"brightness" : 100,
|
||||
"saturation" : 100,
|
||||
"reverse" : false,
|
||||
"color" : [255,255,255],
|
||||
"random-color" : false
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@ rotationTime = float(hyperion.args.get('rotation-time', 3.0))
|
||||
sleepTime = float(hyperion.args.get('sleep-time', 0.05))
|
||||
brightness = float(hyperion.args.get('brightness', 100))/100.0
|
||||
saturation = float(hyperion.args.get('saturation', 100))/100.0
|
||||
reverse = bool(hyperion.args.get('reverse', False))
|
||||
color = list(hyperion.args.get('color', (255,255,255)))
|
||||
randomColor = bool(hyperion.args.get('random-color', False))
|
||||
|
||||
@@ -24,7 +23,7 @@ while not hyperion.abort():
|
||||
if random.random() < 0.005:
|
||||
|
||||
if randomColor:
|
||||
rgb = colorsys.hsv_to_rgb(random.random(), 1, 1)
|
||||
rgb = colorsys.hsv_to_rgb(random.random(), saturation, brightness)
|
||||
for n in range(3):
|
||||
color[n] = int(rgb[n]*255)
|
||||
|
||||
|
148
effects/swirl.py
Normal file
148
effects/swirl.py
Normal file
@@ -0,0 +1,148 @@
|
||||
import hyperion, time, math, random
|
||||
|
||||
# Convert x/y (0.0 - 1.0) point to proper int values based on Hyperion image width/height
|
||||
# Or get a random value
|
||||
# @param bool rand Randomize point if true
|
||||
# @param float x Point at the x axis between 0.0-1.0
|
||||
# @param float y Point at the y axis between 0.0-1.0
|
||||
# @return Tuple with (x,y) as Integer
|
||||
def getPoint(rand = True ,x = 0.5, y = 0.5):
|
||||
if rand:
|
||||
x = random.uniform(0.0, 1.0)
|
||||
y = random.uniform(0.0, 1.0)
|
||||
x = int(round(x*hyperion.imageWidth()))
|
||||
y = int(round(y*hyperion.imageHeight()))
|
||||
return (x,y)
|
||||
|
||||
# Returns the required sleep time for a interval function based on rotationtime and steps
|
||||
# Adapts also to led device latchTime if required
|
||||
# @param float rt RotationTime in seconds (time for one ration, based on steps)
|
||||
# @param int steps The steps it should calc the rotation time
|
||||
# @return Tuple with (x,y) as Integer
|
||||
def getSTime(rt, steps = 360):
|
||||
rt = float(rt)
|
||||
sleepTime = max(0.1, rt) / steps
|
||||
|
||||
# adapt sleeptime to hardware
|
||||
minStepTime= float(hyperion.latchTime)/1000.0
|
||||
if minStepTime > sleepTime:
|
||||
sleepTime = minStepTime
|
||||
return sleepTime
|
||||
|
||||
# Creates a PRGBA bytearray gradient based on provided colors (RGB or RGBA (0-255, 0-1 for alpha)), the color stop positions are calculated based on color count. Requires at least 2 colors!
|
||||
# @param tuple cc Colors in a tuple of RGB or RGBA
|
||||
# @param bool closeCircle If True use last color as first color
|
||||
# @return bytearray A bytearray of RGBA for hyperion.image*Gradient functions
|
||||
def buildGradient(cc, closeCircle = True):
|
||||
if len(cc) > 1:
|
||||
withAlpha = False
|
||||
posfac = int(255/len(cc))
|
||||
ba = bytearray()
|
||||
pos = 0
|
||||
if len(cc[0]) == 4:
|
||||
withAlpha = True
|
||||
|
||||
for c in cc:
|
||||
if withAlpha:
|
||||
alpha = int(c[3]*255)
|
||||
else:
|
||||
alpha = 255
|
||||
pos += posfac
|
||||
ba += bytearray([pos,c[0],c[1],c[2],alpha])
|
||||
|
||||
if closeCircle:
|
||||
# last color as first color
|
||||
lC = cc[-1]
|
||||
if withAlpha:
|
||||
alpha = int(lC[3]*255)
|
||||
else:
|
||||
alpha = 255
|
||||
ba += bytearray([0,lC[0],lC[1],lC[2],alpha])
|
||||
|
||||
return ba
|
||||
|
||||
def rotateAngle( increment = 1):
|
||||
global angle
|
||||
angle += increment
|
||||
if angle > 360: angle=0
|
||||
if angle < 0: angle=360
|
||||
return angle
|
||||
|
||||
def rotateAngle2( increment = 1):
|
||||
global angle2
|
||||
angle2 += increment
|
||||
if angle2 > 360: angle2=0
|
||||
if angle2 < 0: angle2=360
|
||||
return angle2
|
||||
|
||||
# set minimum image size - must be done asap
|
||||
hyperion.imageMinSize(64,64)
|
||||
iW = hyperion.imageWidth()
|
||||
iH = hyperion.imageHeight()
|
||||
|
||||
# Get the parameters
|
||||
rotationTime = float(hyperion.args.get('rotation-time', 10.0))
|
||||
reverse = bool(hyperion.args.get('reverse', False))
|
||||
centerX = float(hyperion.args.get('center_x', 0.5))
|
||||
centerY = float(hyperion.args.get('center_y', 0.5))
|
||||
randomCenter = bool(hyperion.args.get('random-center', False))
|
||||
custColors = hyperion.args.get('custom-colors', ((255,0,0),(0,255,0),(0,0,255)))
|
||||
|
||||
enableSecond = bool(hyperion.args.get('enable-second', False))
|
||||
#rotationTime2 = float(hyperion.args.get('rotation-time2', 5.0))
|
||||
reverse2 = bool(hyperion.args.get('reverse2', True))
|
||||
centerX2 = float(hyperion.args.get('center_x2', 0.5))
|
||||
centerY2 = float(hyperion.args.get('center_y2', 0.5))
|
||||
randomCenter2 = bool(hyperion.args.get('random-center2', False))
|
||||
custColors2 = hyperion.args.get('custom-colors2', ((255,255,255,0),(0,255,255,0),(255,255,255,1),(0,255,255,0),(0,255,255,0),(0,255,255,0),(255,255,255,1),(0,255,255,0),(0,255,255,0),(0,255,255,0),(255,255,255,1),(0,255,255,0)))
|
||||
|
||||
# process parameters
|
||||
pointS1 = getPoint(randomCenter ,centerX, centerY)
|
||||
pointS2 = getPoint(randomCenter2 ,centerX2, centerY2)
|
||||
sleepTime = getSTime(rotationTime)
|
||||
#sleepTime2 = getSTime(rotationTime2)
|
||||
angle = 0
|
||||
angle2 = 0
|
||||
S2 = False
|
||||
|
||||
increment = -1 if reverse else 1
|
||||
increment2 = -1 if reverse2 else 1
|
||||
|
||||
if len(custColors) > 1:
|
||||
baS1 = buildGradient(custColors)
|
||||
else:
|
||||
baS1 = bytearray([
|
||||
0 ,255,0 ,0, 255,
|
||||
25 ,255,230,0, 255,
|
||||
63 ,255,255,0, 255,
|
||||
100,0 ,255,0, 255,
|
||||
127,0 ,255,200, 255,
|
||||
159,0 ,255,255, 255,
|
||||
191,0 ,0 ,255, 255,
|
||||
224,255,0 ,255, 255,
|
||||
255,255,0 ,127, 255,
|
||||
])
|
||||
|
||||
# check if the second swirl should be build
|
||||
if enableSecond and len(custColors2) > 1:
|
||||
S2 = True
|
||||
baS2 = buildGradient(custColors2)
|
||||
|
||||
# effect loop
|
||||
while not hyperion.abort():
|
||||
angle += increment
|
||||
if angle > 360: angle=0
|
||||
if angle < 0: angle=360
|
||||
|
||||
angle2 += increment2
|
||||
if angle2 > 360: angle2=0
|
||||
if angle2 < 0: angle2=360
|
||||
|
||||
hyperion.imageConicalGradient(pointS1[0], pointS1[1], angle, baS1)
|
||||
if S2:
|
||||
hyperion.imageConicalGradient(pointS2[0], pointS2[1], angle2, baS2)
|
||||
|
||||
hyperion.imageShow()
|
||||
time.sleep(sleepTime)
|
||||
|
||||
|
@@ -5,12 +5,13 @@ import random
|
||||
|
||||
min_len = int(hyperion.args.get('min_len', 3))
|
||||
max_len = int(hyperion.args.get('max_len', 3))
|
||||
height = int(hyperion.args.get('height', 8))
|
||||
#iHeight = int(hyperion.args.get('iHeight', 8))
|
||||
trails = int(hyperion.args.get('int', 8))
|
||||
sleepTime = float(hyperion.args.get('speed', 1)) / 1000.0
|
||||
color = list(hyperion.args.get('color', (255,255,255)))
|
||||
randomise = bool(hyperion.args.get('random', False))
|
||||
whidth = hyperion.ledCount / height
|
||||
iWidth = hyperion.imageWidth()
|
||||
iHeight = hyperion.imageHeight()
|
||||
|
||||
class trail:
|
||||
def __init__(self):
|
||||
@@ -48,17 +49,17 @@ for i in range(trails):
|
||||
r = {'exec': trail()}
|
||||
|
||||
if randomise:
|
||||
col = (random.uniform(0.1, 1.0), random.uniform(0.1, 1.0), random.uniform(0.1, 1.0))
|
||||
col = (random.uniform(0.0, 1.0),1,1)
|
||||
else:
|
||||
col = colorsys.rgb_to_hsv(color[0]/255.0, color[1]/255.0, color[2]/255.0)
|
||||
|
||||
r['exec'].start(
|
||||
random.randint(0, whidth),
|
||||
random.randint(0, height),
|
||||
random.randint(0, iWidth),
|
||||
random.randint(0, iHeight),
|
||||
random.uniform(0.2, 0.8),
|
||||
col,
|
||||
random.randint(min_len, max_len),
|
||||
height
|
||||
iHeight
|
||||
)
|
||||
tr.append(r)
|
||||
|
||||
@@ -70,21 +71,21 @@ while not hyperion.abort():
|
||||
r['x'], r['data'], c = r['exec'].getdata()
|
||||
if c:
|
||||
if randomise:
|
||||
col = (random.uniform(0.1, 1.0), random.uniform(0.1, 1.0), random.uniform(0.1, 1.0))
|
||||
col = (random.uniform(0.0, 1.0),1,1)
|
||||
else:
|
||||
col = colorsys.rgb_to_hsv(color[0]/255.0, color[1]/255.0, color[2]/255.0)
|
||||
|
||||
r['exec'].start(
|
||||
random.randint(0, whidth),
|
||||
random.randint(0, height),
|
||||
random.randint(0, iWidth),
|
||||
random.randint(0, iHeight),
|
||||
random.uniform(0.2, 0.8),
|
||||
col,
|
||||
random.randint(min_len, max_len),
|
||||
height
|
||||
iHeight
|
||||
)
|
||||
|
||||
for y in range(0, height):
|
||||
for x in range(0, whidth):
|
||||
for y in range(0, iHeight):
|
||||
for x in range(0, iWidth):
|
||||
for r in tr:
|
||||
if x == r['x']:
|
||||
led = bytearray(r['data'][y])
|
||||
@@ -92,6 +93,6 @@ while not hyperion.abort():
|
||||
led = bytearray((0,0,0))
|
||||
ledData += led
|
||||
|
||||
hyperion.setImage(whidth,height,ledData)
|
||||
hyperion.setImage(iWidth,iHeight,ledData)
|
||||
time.sleep(sleepTime)
|
||||
|
||||
|
Reference in New Issue
Block a user