From 034031f37f834564ce179cd7526dab1014872d24 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tomas=20Wenstr=C3=B6m?= Date: Mon, 4 Sep 2017 16:19:00 +0200 Subject: [PATCH] Added 2 ambient modes --- src/kaka/cakelight/AmbientMode.java | 14 ++++++++++++++ src/kaka/cakelight/Console.java | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/kaka/cakelight/AmbientMode.java b/src/kaka/cakelight/AmbientMode.java index 2b10e31..7836b90 100644 --- a/src/kaka/cakelight/AmbientMode.java +++ b/src/kaka/cakelight/AmbientMode.java @@ -77,6 +77,20 @@ public class AmbientMode extends Mode { // TODO split into DynamicAmbient and St double value = Math.abs((ledOffset * 2 - ledCount) / ledCount); // 1 to 0 to 1 frame.setLedColor(i, Color.hsv(value * hueLength + hueOffset, 1, 1)); } + } else if (type == 3) { + for (int i = 0; i < config.leds.getCount(); i++) { + double x = frame.xOf(i); + double y = frame.yOf(i); + double g = Math.pow(Math.min(1, Math.max(0, noise.getr(0.0, 1.0, 1, x, y, time / 7000.0))), 1.5); + frame.setLedColor(i, Color.rgb(0, g, 1 - g * 0.5)); + } + } else if (type == 4) { + for (int i = 0; i < config.leds.getCount(); i++) { + double x = frame.xOf(i); + double y = frame.yOf(i); + double g = Math.pow(Math.min(1, Math.max(0, noise.getr(0.0, 1.0, 1, x, y, time / 7000.0))), 1.5); + frame.setLedColor(i, Color.rgb(1, g, 0)); + } } } diff --git a/src/kaka/cakelight/Console.java b/src/kaka/cakelight/Console.java index a856203..00a1269 100644 --- a/src/kaka/cakelight/Console.java +++ b/src/kaka/cakelight/Console.java @@ -25,7 +25,7 @@ public class Console extends Thread { System.out.print("> "); try { String input = reader.readLine(); - if (input.equals("0") || input.equals("1") || input.equals("2")) { + if (input.equals("0") || input.equals("1") || input.equals("2") || input.equals("3") || input.equals("4")) { cakelight.setMode(new AmbientMode(new String[] {input})); System.out.println("setting ambient mode to " + input); } else if (input.matches("(b|brightness)\\s+[0-9]+")) { -- 2.11.0