var Watch = function() { var date = new Date; var hours = date.getHours(); var minutes = date.getMinutes(); var seconds = date.getSeconds(); this.calcHours = function() { var hourWidth = 100 / 24; // 100% / 24horas document.getElementById('hours').style.width = hourWidth * hours + '%'; }; this.calcMinutes = function() { var minuteWidth = 100 / 59; // 100% / 59min var width = minuteWidth * minutes + '%'; document.getElementById('minutes').style.width = width; }; this.calcSeconds = function() { var secondWidth = 100 / 59; // 100% / 59sec var width = secondWidth * seconds + '%'; document.getElementById('seconds').style.width = width; }; }; var interface = new Watch(); interface.calcHours(); interface.calcMinutes(); interface.calcSeconds(); setInterval(function() { var interface = new Watch(); interface.calcMinutes(); interface.calcSeconds(); }, 1000);