jQuery Knob actualiza el valor con animate
Estoy tratando de construir reloj usando jQuery Knob. Mi reloj esta funcionandohttp://jsfiddle.net/Misiu/9Whck/1/), pero en este momento estoy tratando de agregar algunos extras.
Al principio quiero tener todos los mandos configurados en 0, luego usaranimate
Quiero animar su valor a la hora actual y luego iniciar la actualización normal del temporizador.
Mi código se ve así (demo aquí:http://jsfiddle.net/Misiu/cvQED/81/):
$.when(
$('.h').animate({
value: h
}, {
duration: 1000,
easing: 'swing',
progress: function () {
$(this).val(Math.round(this.value)).trigger('change');
}
}),
$('.m').animate({
value: m
}, {
duration: 1000,
easing: 'swing',
progress: function () {
$(this).val(Math.round(this.value)).trigger('change');
}
}),
$('.s').animate({
value: s
}, {
duration: 1000,
easing: 'swing',
progress: function () {
$(this).val(Math.round(this.value)).trigger('change');
}
})).then(function () {
myDelay();
});
function myDelay() {
var d = new Date(),
s = d.getSeconds(),
m = d.getMinutes(),
h = d.getHours();
$('.h').val(h).trigger("change");
$('.m').val(m).trigger("change");
$('.s').val(s).trigger("change");
setTimeout(myDelay, 1000)
}
Enwhen
Debo llamar animar para cada mando por separado, pero me gustaría usardata-targetValue
y tener un solo animar por dentro cuando.
Se puede hacer esto?