From 9e149308f4201b234c9c4731436949246048e2d4 Mon Sep 17 00:00:00 2001 From: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com> Date: Tue, 12 May 2020 19:52:46 +0200 Subject: [PATCH] new effect plasma (#792) Signed-off-by: Paulchen-Panther --- assets/webconfig/i18n/cs.json | 2 ++ assets/webconfig/i18n/de.json | 4 +++- assets/webconfig/i18n/en.json | 2 ++ assets/webconfig/i18n/es.json | 2 ++ assets/webconfig/i18n/it.json | 2 ++ assets/webconfig/i18n/nl.json | 2 ++ assets/webconfig/i18n/pl.json | 2 ++ assets/webconfig/i18n/ro.json | 2 ++ assets/webconfig/i18n/sv.json | 2 ++ effects/plasma.json | 8 +++++++ effects/plasma.py | 35 ++++++++++++++++++++++++++++++ effects/schema/plasma.schema.json | 18 +++++++++++++++ effects/{Waves.json => waves.json} | 0 13 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 effects/plasma.json create mode 100644 effects/plasma.py create mode 100644 effects/schema/plasma.schema.json rename effects/{Waves.json => waves.json} (100%) diff --git a/assets/webconfig/i18n/cs.json b/assets/webconfig/i18n/cs.json index 732d3c2a..d794bdb7 100644 --- a/assets/webconfig/i18n/cs.json +++ b/assets/webconfig/i18n/cs.json @@ -808,6 +808,8 @@ "edt_conf_net_localAdminAuth_expl": "", "edt_eff_collision_header": "", "edt_eff_collision_header_desc": "", + "edt_eff_plasma_header": "", + "edt_eff_plasma_header_desc": "", "edt_eff_explodeRadius": "", "edt_dev_spec_printTimeStamp_title": "", "edt_eff_ledtest_header": "", diff --git a/assets/webconfig/i18n/de.json b/assets/webconfig/i18n/de.json index e24e974c..8910b79c 100644 --- a/assets/webconfig/i18n/de.json +++ b/assets/webconfig/i18n/de.json @@ -710,7 +710,9 @@ "edt_eff_flag_header_desc": "Verpasse deinen LEDs die Farben deines Landes. Du kannst mehr als eine Flagge auswählen, je nach Intervall werden diese dann abwechselnd angezeigt.", "edt_eff_collision_header": "Farbkollision", "edt_eff_collision_header_desc": "Zwei Farbprojektile werden von zufälligen Positionen gesendet und kollidieren miteinander", - "edt_eff_explodeRadius": "Detonationsreichweite ", + "edt_eff_plasma_header": "Plasma", + "edt_eff_plasma_header_desc": "Farbverzerrungen in verschiedenen Richtungen", + "edt_eff_explodeRadius": "Detonationsreichweite", "edt_eff_enum_all": "Alle", "edt_eff_enum_all-together": "Alle zusammen", "edt_eff_enum_list": "LED Liste", diff --git a/assets/webconfig/i18n/en.json b/assets/webconfig/i18n/en.json index 21a444c8..fbabb36c 100644 --- a/assets/webconfig/i18n/en.json +++ b/assets/webconfig/i18n/en.json @@ -709,6 +709,8 @@ "edt_eff_flag_header_desc" : "Let your leds shine bright in the colours of your country. You can select more than one flag and they will change based on the interval time.", "edt_eff_collision_header": "colour collision", "edt_eff_collision_header_desc": "Two colour projectiles are sent from random positions and collide with each other", + "edt_eff_plasma_header": "Plasma", + "edt_eff_plasma_header_desc": "Color distortion in different directions", "edt_eff_explodeRadius": "Detonation Range ", "edt_eff_enum_all" : "All", "edt_eff_enum_all-together" : "All together", diff --git a/assets/webconfig/i18n/es.json b/assets/webconfig/i18n/es.json index 5e5bf826..21a0455a 100644 --- a/assets/webconfig/i18n/es.json +++ b/assets/webconfig/i18n/es.json @@ -808,6 +808,8 @@ "edt_conf_net_localAdminAuth_expl": "Cuando está habilitado, el acceso de administración desde tu red doméstica necesita una contraseña.", "edt_eff_collision_header": "colisión de colores", "edt_eff_collision_header_desc": "Dos proyectiles de color se envían desde posiciones aleatorias y chocan entre sí", + "edt_eff_plasma_header": "", + "edt_eff_plasma_header_desc": "", "edt_eff_explodeRadius": "Rango de detonación", "edt_dev_spec_printTimeStamp_title": "Añadir marca de tiempo", "edt_eff_ledtest_header": "Prueba de Led", diff --git a/assets/webconfig/i18n/it.json b/assets/webconfig/i18n/it.json index 94d7dc7f..663fab84 100644 --- a/assets/webconfig/i18n/it.json +++ b/assets/webconfig/i18n/it.json @@ -808,6 +808,8 @@ "edt_conf_net_localAdminAuth_expl": "Quando abilitato, l'accesso da amministratore dal tuo network domestico necessita di password", "edt_eff_collision_header": "collisione colore", "edt_eff_collision_header_desc": "Due proiettili colorati partono da due posizioni casuali e collidono tra loro", + "edt_eff_plasma_header": "", + "edt_eff_plasma_header_desc": "", "edt_eff_explodeRadius": "Raggio di detonazione ", "edt_dev_spec_printTimeStamp_title": "Aggiungi timestamp", "edt_eff_ledtest_header": "", diff --git a/assets/webconfig/i18n/nl.json b/assets/webconfig/i18n/nl.json index 2769b315..9da00b2d 100644 --- a/assets/webconfig/i18n/nl.json +++ b/assets/webconfig/i18n/nl.json @@ -808,6 +808,8 @@ "edt_conf_net_localAdminAuth_expl": "", "edt_eff_collision_header": "", "edt_eff_collision_header_desc": "", + "edt_eff_plasma_header": "", + "edt_eff_plasma_header_desc": "", "edt_eff_explodeRadius": "", "edt_dev_spec_printTimeStamp_title": "", "edt_eff_ledtest_header": "", diff --git a/assets/webconfig/i18n/pl.json b/assets/webconfig/i18n/pl.json index 12f837fe..80cad732 100644 --- a/assets/webconfig/i18n/pl.json +++ b/assets/webconfig/i18n/pl.json @@ -808,6 +808,8 @@ "edt_conf_net_localAdminAuth_expl": "", "edt_eff_collision_header": "", "edt_eff_collision_header_desc": "", + "edt_eff_plasma_header": "", + "edt_eff_plasma_header_desc": "", "edt_eff_explodeRadius": "", "edt_dev_spec_printTimeStamp_title": "", "edt_eff_ledtest_header": "", diff --git a/assets/webconfig/i18n/ro.json b/assets/webconfig/i18n/ro.json index 166e58c4..330a85ad 100644 --- a/assets/webconfig/i18n/ro.json +++ b/assets/webconfig/i18n/ro.json @@ -808,6 +808,8 @@ "edt_conf_net_localAdminAuth_expl": "", "edt_eff_collision_header": "", "edt_eff_collision_header_desc": "", + "edt_eff_plasma_header": "", + "edt_eff_plasma_header_desc": "", "edt_eff_explodeRadius": "", "edt_dev_spec_printTimeStamp_title": "", "edt_eff_ledtest_header": "", diff --git a/assets/webconfig/i18n/sv.json b/assets/webconfig/i18n/sv.json index d2e70d8a..f80ff3e9 100644 --- a/assets/webconfig/i18n/sv.json +++ b/assets/webconfig/i18n/sv.json @@ -808,6 +808,8 @@ "edt_conf_net_localAdminAuth_expl": "När aktiverad, behövs ett lösenord för administrering i nätverket.", "edt_eff_collision_header": "färgkollision", "edt_eff_collision_header_desc": "Två färgprojektiler skickas från slumpmässiga positioner och kolliderar med varandra", + "edt_eff_plasma_header": "", + "edt_eff_plasma_header_desc": "", "edt_eff_explodeRadius": "Detonationsområde", "edt_dev_spec_printTimeStamp_title": "Lägg till tidsstämpel", "edt_eff_ledtest_header": "LED-test", diff --git a/effects/plasma.json b/effects/plasma.json new file mode 100644 index 00000000..27b2aaee --- /dev/null +++ b/effects/plasma.json @@ -0,0 +1,8 @@ +{ + "name" : "Plasma", + "script" : "plasma.py", + "args" : + { + "sleepTime" : 0.20 + } +} diff --git a/effects/plasma.py b/effects/plasma.py new file mode 100644 index 00000000..7b4a7758 --- /dev/null +++ b/effects/plasma.py @@ -0,0 +1,35 @@ +import hyperion, time, colorsys, math + +hyperion.imageMinSize(64, 64) +width = hyperion.imageWidth() +height = hyperion.imageHeight() +sleepTime = float(hyperion.args.get('sleepTime', 0.2)) + +def mapto(x, in_min, in_max, out_min, out_max): + return float((x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min) + +pal = [] +for h in range(256): + r, g, b = colorsys.hsv_to_rgb(mapto(h, 0.0, 255.0, 0.0, 1.0), 1.0, 1.0) + pal.append( bytearray( (int(r*255), int(g*255), int(b*255)) ) ) + +plasma = [[]] +for x in range(width): + plasma.append([]) + for y in range(height): + color = int(128.0 + (128.0 * math.sin(x / 16.0)) + \ + 128.0 + (128.0 * math.sin(y / 8.0)) + \ + 128.0 + (128.0 * math.sin((x+y)) / 16.0) + \ + 128.0 + (128.0 * math.sin(math.sqrt(x**2.0 + y**2.0) / 8.0))) / 4 + plasma[x].append(color) + +while not hyperion.abort(): + ledData = bytearray() + mod = time.clock() * 100 + for x in range(height): + for y in range(width): + ledData += pal[int((plasma[y][x] + mod) % 256)] + + hyperion.setImage(width,height,ledData) + time.sleep(sleepTime) + diff --git a/effects/schema/plasma.schema.json b/effects/schema/plasma.schema.json new file mode 100644 index 00000000..4d896652 --- /dev/null +++ b/effects/schema/plasma.schema.json @@ -0,0 +1,18 @@ +{ + "type":"object", + "script" : "plasma.py", + "title": "edt_eff_plasma_header", + "required": true, + "properties": { + "sleepTime": { + "type": "number", + "title":"edt_eff_sleeptime", + "default": 0.20, + "minimum" : 0.01, + "step": 0.01, + "append" : "edt_append_s", + "propertyOrder" : 1 + } + }, + "additionalProperties": false +} diff --git a/effects/Waves.json b/effects/waves.json similarity index 100% rename from effects/Waves.json rename to effects/waves.json