Browse Source

Better use the step than js for the breath slider

Aubort Jean-Baptiste 6 years ago
parent
commit
1a076efdb1
2 changed files with 5 additions and 5 deletions
  1. 4 4
      main.js
  2. 1 1
      trigger.html

+ 4 - 4
main.js

@@ -207,18 +207,18 @@ function switchTheLight(red, green, blue) {
     requestObject.send("red=" + red + "&green=" + green + "&blue=" + blue + "&breath=" + breathValue);
 }
 
-var lastBreathValue = 0;
+//var lastBreathValue = 0;
 function setTheBreathSpeed() {
     "set strict";
     var breathValue = slider.value;
-    if (Math.abs(breathValue - lastBreathValue) > 100) {
+    //if (Math.abs(breathValue - lastBreathValue) > 100) {
         var requestUrl = "http://led.fixme.ch/rgb/";
         var requestObject = new XMLHttpRequest();
         requestObject.open("POST", requestUrl, true);
         requestObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
         requestObject.send("breath=" + breathValue);
-        lastBreathValue = breathValue;
-    }
+    //    lastBreathValue = breathValue;
+    //}
     document.getElementById("breathValue").innerText = breathValue;
 }
 

+ 1 - 1
trigger.html

@@ -61,7 +61,7 @@
         <br/>
         <div id="breathBox">
             <label for="breathSlider">Breath:</label>
-            <input type="range" value=0 min=0 max=10000 step=50 onchange="setTheBreathSpeed()" id="breathSlider" class="breathSlider">
+            <input type="range" value=0 min=0 max=10000 step=100 onchange="setTheBreathSpeed()" id="breathSlider" class="breathSlider">
             <span id="breathValue">0</span>
         </div>
       </fieldset>