diff options
| author | Jules <jules@asdf.us> | 2015-04-20 00:42:17 -0400 |
|---|---|---|
| committer | Jules <jules@asdf.us> | 2015-04-20 00:42:17 -0400 |
| commit | 3c3be38fb6b85016e3e9aed973955688835a26dd (patch) | |
| tree | e3de2bf10dc0d3c480285db6330775b1cca66e0d /webcam.html | |
| parent | aede4580450a2d8c37825d22871fa90cc15c1528 (diff) | |
timer button
Diffstat (limited to 'webcam.html')
| -rw-r--r-- | webcam.html | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/webcam.html b/webcam.html index 4d352d8..bf528d2 100644 --- a/webcam.html +++ b/webcam.html @@ -33,6 +33,7 @@ label { min-width: 70px; display: inline-block; } <br> <input type="text" id="text_style"> <button id="save_el">SAVE</button> + <button id="timer_el">TIMER</button> </body> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> @@ -100,12 +101,13 @@ listen(sat_el, window, "sat") listen(lum_el, window, "lum") listen(quant_el, window, "quant") -save_el.addEventListener('click', function(){ +save_el.addEventListener('click', save) +function save (){ MircColor.fromCanvas(camera, saveText, { width: width, ratio: ratio, neighbor: nn }) function saveText(rows) { text_style.value = MircColor.ascii(rows) } -}) +} nn_el.addEventListener('change', function(){ nn = $(nn_el).prop('checked') }) @@ -148,6 +150,18 @@ function toCanvas(rows){ image_style.innerHTML = "" image_style.appendChild(canvas) } - +timer_el.addEventListener("click", function(){ + var secs = 5; + (function step (){ + if (secs > 0) { + timer_el.innerHTML = secs-- + setTimeout(step, 1000) + } + else { + timer_el.innerHTML = "TIMER" + save() + } + })() +}) </script> |
