Javascript-форум (https://javascript.ru/forum/)
-   Общие вопросы Javascript (https://javascript.ru/forum/misc/)
-   -   SetTimeOut анимация javascript (https://javascript.ru/forum/misc/64940-settimeout-animaciya-javascript.html)

thystruby 15.09.2016 10:37

SetTimeOut анимация javascript
 
:help: :help: :help:

Делаю приложение веб-камера( с фильтрами и т.п) . Есть метод SetTimeOut, который после нажатия на кнопку делает снимок через определенное время. Как сделать так, что бы при нажатии на кнопку одновременно с отсчетом времени settimeout до снимка на экран выводились цифры типа ( 3....2....1).


video3.addEventListener("click", function () {
       setTimeout( function () {
           var snap = takeSnapshot();

           // Show image.
           image.setAttribute('src', snap);


           // Enable delete and save buttons
           delete_photo_btn.classList.remove("disabled");
           download_photo_btn.classList.remove("disabled");

           // Set the href attribute of the download button to the snap url.
           download_photo_btn.href = image.src;

           filterVisible();

           take_photo_btn.classList.add('disabled');
           video3.classList.add('disabled');
           video5.classList.add('disabled');

          document.querySelector('div#back1').classList.add('disabled');

           $('div.stop-video').addClass('disables');

           if (document.querySelector('div.stop-video').classList.contains('visible')){
               document.querySelector('div.stop-video').classList.remove('visible')
           }

           // Pause video playback of stream.
           video.pause();
       },2300)
    });

рони 15.09.2016 10:43

thystruby,
не дублируйте темы


Часовой пояс GMT +3, время: 16:00.