From: Tomas Wenström Date: Mon, 4 Sep 2017 14:19:00 +0000 (+0200) Subject: Added 2 ambient modes X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=034031f37f834564ce179cd7526dab1014872d24;p=kaka%2Fcakelight.git Added 2 ambient modes --- 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]+")) {