mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
disable smoothing for effects (#425)
* no smooth for efx rework fade effect * join strobe and fade effects new effect "breath" * - make transition efx to smooth mode more smooth - fixes for pacman - rework fade base effect - make it more versatile - fix prios in schema files - new notify blue effect to demonstrate capability of fade effect
This commit is contained in:
15
effects/breath.json
Normal file
15
effects/breath.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name" : "Breath",
|
||||
"script" : "fade.py",
|
||||
"args" :
|
||||
{
|
||||
"color-end": [ 255, 255, 255 ],
|
||||
"color-start": [ 50, 50, 50 ],
|
||||
"fade-in-time" : 4000,
|
||||
"fade-out-time" : 1000,
|
||||
"color-start-time" : 50,
|
||||
"color-end-time" : 250,
|
||||
"repeat-count" : 0,
|
||||
"maintain-end-color" : true
|
||||
}
|
||||
}
|
@@ -3,7 +3,7 @@
|
||||
"script" : "candle.py",
|
||||
"args" :
|
||||
{
|
||||
"sleepTime" : 0.15,
|
||||
"sleepTime" : 0.20,
|
||||
"brightness" : 100,
|
||||
"color" : [ 255, 138, 0 ],
|
||||
"candles" : "all"
|
||||
|
@@ -3,8 +3,13 @@
|
||||
"script" : "fade.py",
|
||||
"args" :
|
||||
{
|
||||
"fade-time" : 5.0,
|
||||
"color-start" : [ 136, 97, 7 ],
|
||||
"color-end" : [ 238, 173, 47 ]
|
||||
"color-end" : [ 238, 173, 47 ],
|
||||
"fade-in-time" : 5000,
|
||||
"fade-out-time" : 0,
|
||||
"color-start-time" : 0,
|
||||
"color-end-time" : 0,
|
||||
"repeat-count" : 1,
|
||||
"maintain-end-color" : true
|
||||
}
|
||||
}
|
||||
|
@@ -3,8 +3,13 @@
|
||||
"script" : "fade.py",
|
||||
"args" :
|
||||
{
|
||||
"fade-time" : 5.0,
|
||||
"color-start" : [ 238, 173, 47 ],
|
||||
"color-end" : [ 136, 97, 7 ]
|
||||
"color-start" : [ 136, 97, 7 ],
|
||||
"color-end" : [ 238, 173, 47 ],
|
||||
"fade-in-time" : 0,
|
||||
"fade-out-time" : 5000,
|
||||
"color-start-time" : 0,
|
||||
"color-end-time" : 0,
|
||||
"repeat-count" : 1,
|
||||
"maintain-end-color" : true
|
||||
}
|
||||
}
|
||||
|
@@ -1,27 +1,88 @@
|
||||
import hyperion, time
|
||||
|
||||
# Get the parameters
|
||||
fadeTime = float(hyperion.args.get('fade-time', 5.0))
|
||||
colorStart = hyperion.args.get('color-start', (255,174,11))
|
||||
colorEnd = hyperion.args.get('color-end', (100,100,100))
|
||||
fadeInTime = float(hyperion.args.get('fade-in-time', 2000)) / 1000.0
|
||||
fadeOutTime = float(hyperion.args.get('fade-out-time', 2000)) / 1000.0
|
||||
colorStart = hyperion.args.get('color-start', (255,174,11))
|
||||
colorEnd = hyperion.args.get('color-end', (0,0,0))
|
||||
colorStartTime = float(hyperion.args.get('color-start-time', 1000)) / 1000
|
||||
colorEndTime = float(hyperion.args.get('color-end-time', 1000)) / 1000
|
||||
repeat = hyperion.args.get('repeat-count', 0)
|
||||
maintainEndCol = hyperion.args.get('maintain-end-color', True)
|
||||
minStepTime = 0.03
|
||||
currentR = currentG = currentB = 0
|
||||
|
||||
# create color table for fading from start to end color
|
||||
color_step = (
|
||||
(colorEnd[0] - colorStart[0]) / 256.0,
|
||||
(colorEnd[1] - colorStart[1]) / 256.0,
|
||||
(colorEnd[2] - colorStart[2]) / 256.0
|
||||
)
|
||||
|
||||
# fade color
|
||||
calcChannel = lambda i: min(max(int(colorStart[i] + color_step[i]*step),0),255)
|
||||
colors = []
|
||||
for step in range(256):
|
||||
if hyperion.abort():
|
||||
break
|
||||
colors.append( (calcChannel(0),calcChannel(1),calcChannel(2)) )
|
||||
|
||||
hyperion.setColor( calcChannel(0),calcChannel(1),calcChannel(2) )
|
||||
time.sleep( fadeTime / 256 )
|
||||
# calculate timings
|
||||
if fadeInTime>0:
|
||||
incrementIn = max(1,int(round(256.0 / (fadeInTime / minStepTime) )))
|
||||
sleepTimeIn = fadeInTime / (256.0 / incrementIn)
|
||||
else:
|
||||
incrementIn = sleepTimeIn = 1
|
||||
|
||||
if fadeOutTime>0:
|
||||
incrementOut = max(1,int(round(256.0 / (fadeOutTime / minStepTime) )))
|
||||
sleepTimeOut = fadeOutTime / (256.0 / incrementOut)
|
||||
else:
|
||||
incrementOut = sleepTimeOut = 1
|
||||
|
||||
# maintain color until effect end
|
||||
hyperion.setColor(colorEnd[0],colorEnd[1],colorEnd[2])
|
||||
def setColor(r,g,b):
|
||||
global currentR,currentG,currentB
|
||||
|
||||
currentR = r
|
||||
currentG = g
|
||||
currentB = b
|
||||
hyperion.setColor(r,g,b)
|
||||
|
||||
# loop
|
||||
repeatCounter = 1
|
||||
while not hyperion.abort():
|
||||
time.sleep(1)
|
||||
# fade in
|
||||
if fadeInTime > 0:
|
||||
for step in range(0,256,incrementIn):
|
||||
if hyperion.abort(): break
|
||||
setColor( colors[step][0],colors[step][1],colors[step][2] )
|
||||
time.sleep(sleepTimeIn)
|
||||
|
||||
# end color
|
||||
t = 0.0
|
||||
while t<colorStartTime and not hyperion.abort():
|
||||
setColor( colors[255][0],colors[255][1],colors[255][2] )
|
||||
time.sleep(0.01)
|
||||
t += 0.01
|
||||
|
||||
# fade out
|
||||
if fadeOutTime > 0:
|
||||
for step in range(255,-1,-incrementOut):
|
||||
if hyperion.abort(): break
|
||||
hyperion.setColor( colors[step][0],colors[step][1],colors[step][2] )
|
||||
time.sleep(sleepTimeOut)
|
||||
|
||||
# start color
|
||||
t = 0.0
|
||||
while t<colorEndTime and not hyperion.abort():
|
||||
setColor( colors[0][0],colors[0][1],colors[0][2] )
|
||||
time.sleep(0.01)
|
||||
t += 0.01
|
||||
|
||||
# repeat
|
||||
if repeat > 0 and repeatCounter >= repeat : break
|
||||
repeatCounter += 1
|
||||
|
||||
time.sleep(0.5)
|
||||
# maintain end color until effect end
|
||||
while not hyperion.abort() and maintainEndCol:
|
||||
hyperion.setColor( currentR, currentG, currentB )
|
||||
time.sleep(1)
|
||||
|
||||
|
16
effects/notify-blue.json
Normal file
16
effects/notify-blue.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name" : "Notify blue",
|
||||
"script" : "fade.py",
|
||||
"args" :
|
||||
{
|
||||
"color-start": [ 0, 0, 50 ],
|
||||
"color-end": [ 0, 0, 255 ],
|
||||
"fade-in-time" : 200,
|
||||
"fade-out-time" : 100,
|
||||
"color-start-time" : 40,
|
||||
"color-end-time" : 150,
|
||||
"repeat-count" : 3,
|
||||
"maintain-end-color" : false
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,6 @@
|
||||
"args" :
|
||||
{
|
||||
"margin-pos" : 2.0,
|
||||
"rotationTime" : 8
|
||||
"rotationTime" : 4
|
||||
}
|
||||
}
|
||||
|
@@ -1,17 +1,15 @@
|
||||
import hyperion
|
||||
import time
|
||||
import colorsys
|
||||
import hyperion, time, colorsys
|
||||
from random import randint
|
||||
|
||||
#get args
|
||||
rotationTime = int(hyperion.args.get('rotationTime', 8))
|
||||
marginPos = float(hyperion.args.get('margin-pos', 1.5))
|
||||
rotationTime = float(hyperion.args.get('rotationTime', 4))
|
||||
marginPos = float(hyperion.args.get('margin-pos', 2))
|
||||
|
||||
# define pacman
|
||||
pacman = bytearray((255, 255, 0))
|
||||
|
||||
# define ghosts
|
||||
redGuy = bytearray((255, 0, 0))
|
||||
redGuy = bytearray((255, 0, 0))
|
||||
pinkGuy = bytearray((255, 184, 255))
|
||||
blueGuy = bytearray((0, 255, 255))
|
||||
slowGuy = bytearray((255, 184, 81))
|
||||
@@ -20,10 +18,10 @@ light = bytearray((255, 184, 174))
|
||||
background = bytearray((0, 0, 0))
|
||||
|
||||
#helper
|
||||
posPac = 1
|
||||
diffPac = 6*marginPos
|
||||
diffGuys = 3*marginPos
|
||||
sleepTime = rotationTime/ledCount
|
||||
posPac = 1
|
||||
diffPac = 6*marginPos
|
||||
diffGuys = 3*marginPos
|
||||
sleepTime = max(0.02,rotationTime/hyperion.ledCount)
|
||||
|
||||
posPinkGuy = posPac + diffPac
|
||||
posBlueGuy = posPinkGuy + diffGuys
|
||||
@@ -89,7 +87,8 @@ while not hyperion.abort():
|
||||
shiftLED(ledData, increment, hyperion.ledCount - random, s)
|
||||
|
||||
# chase mode
|
||||
shift = 3*(hyperion.ledCount - random)
|
||||
ledData=ledDataChase[shift:]+ledDataChase[:shift]
|
||||
shift = 3*(hyperion.ledCount - random)
|
||||
ledData = ledDataChase[shift:]+ledDataChase[:shift]
|
||||
shiftLED(ledData, -increment, 2*hyperion.ledCount-random)
|
||||
time.sleep(sleepTime)
|
||||
|
||||
|
@@ -4,14 +4,6 @@
|
||||
"title":"edt_eff_fade_header_title",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"fade-time": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_fadetime_title",
|
||||
"default": 5.0,
|
||||
"minimum" : 0.1,
|
||||
"append" : "edt_append_s",
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"color-start": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_colorstart_title",
|
||||
@@ -25,8 +17,24 @@
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"color-start-time": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_colorstarttime_title",
|
||||
"default": 1000,
|
||||
"minimum" : 0,
|
||||
"append" : "edt_append_ms",
|
||||
"propertyOrder" : 2
|
||||
},
|
||||
"fade-in-time": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_fadeintime_title",
|
||||
"default": 2000,
|
||||
"minimum" : 0,
|
||||
"append" : "edt_append_ms",
|
||||
"propertyOrder" : 3
|
||||
},
|
||||
"color-end": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_colorend_title",
|
||||
@@ -39,8 +47,36 @@
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder" : 3
|
||||
}
|
||||
"propertyOrder" : 4
|
||||
},
|
||||
"color-end-time": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_colorendtime_title",
|
||||
"default": 1000,
|
||||
"minimum" : 0,
|
||||
"append" : "edt_append_ms",
|
||||
"propertyOrder" : 5
|
||||
},
|
||||
"fade-out-time": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_fadeouttime_title",
|
||||
"default": 2000,
|
||||
"minimum" : 0,
|
||||
"append" : "edt_append_ms",
|
||||
"propertyOrder" : 6
|
||||
},
|
||||
"repeat-count": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_repeatcount_title",
|
||||
"default": 0,
|
||||
"propertyOrder" : 7
|
||||
},
|
||||
"maintain-end-color": {
|
||||
"type": "boolean",
|
||||
"title":"edt_eff_maintain_end_color_title",
|
||||
"default": true,
|
||||
"propertyOrder" : 8
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
@@ -1,31 +0,0 @@
|
||||
{
|
||||
"type":"object",
|
||||
"script" : "strobe.py",
|
||||
"title":"edt_eff_storbe_header_title",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"color": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_color_title",
|
||||
"format":"colorpicker",
|
||||
"default": [255,0,0],
|
||||
"items" : {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"frequency": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_frequency_title",
|
||||
"default": 10.0,
|
||||
"minimum" : 0.1,
|
||||
"append" : "edt_append_hz",
|
||||
"propertyOrder" : 2
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"name" : "Strobe blue",
|
||||
"script" : "strobe.py",
|
||||
"args" :
|
||||
{
|
||||
"color" : [ 0, 0, 255 ],
|
||||
"frequency" : 5.0
|
||||
}
|
||||
}
|
15
effects/strobe-red.json
Normal file
15
effects/strobe-red.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name" : "Strobe red",
|
||||
"script" : "fade.py",
|
||||
"args" :
|
||||
{
|
||||
"color-start": [ 255, 0, 0 ],
|
||||
"color-end": [ 0, 0, 0 ],
|
||||
"fade-in-time" : 100,
|
||||
"fade-out-time" : 100,
|
||||
"color-start-time" : 100,
|
||||
"color-end-time" : 100,
|
||||
"repeat-count" : 0,
|
||||
"maintain-end-color" : true
|
||||
}
|
||||
}
|
@@ -1,9 +1,15 @@
|
||||
{
|
||||
"name" : "Strobe white",
|
||||
"script" : "strobe.py",
|
||||
"script" : "fade.py",
|
||||
"args" :
|
||||
{
|
||||
"color" : [ 255, 255, 255 ],
|
||||
"frequency" : 5.0
|
||||
"color-start": [ 255, 255, 255 ],
|
||||
"color-end": [ 0, 0, 0 ],
|
||||
"fade-in-time" : 0,
|
||||
"fade-out-time" : 100,
|
||||
"color-start-time" : 50,
|
||||
"color-end-time" : 10,
|
||||
"repeat-count" : 0,
|
||||
"maintain-end-color" : true
|
||||
}
|
||||
}
|
||||
|
@@ -1,18 +0,0 @@
|
||||
import hyperion, time
|
||||
|
||||
# Get the rotation time
|
||||
color = hyperion.args.get('color', (255,255,255))
|
||||
frequency = float(hyperion.args.get('frequency', 10.0))
|
||||
|
||||
# Check parameters
|
||||
frequency = min(100.0, frequency)
|
||||
|
||||
# Compute the strobe interval
|
||||
sleepTime = 0.5 / frequency
|
||||
|
||||
# Start the write data loop
|
||||
while not hyperion.abort():
|
||||
hyperion.setColor(0, 0, 0)
|
||||
time.sleep(sleepTime)
|
||||
hyperion.setColor(color[0], color[1], color[2])
|
||||
time.sleep(sleepTime)
|
Reference in New Issue
Block a user