キャンバス上の数値のスライドではなく、カチカチという動きを作成するには、数値を0,2秒で上に移動し、0,8秒待ちます。コードはスライドの動きには適していますが、カチカチ音を立てるには迷子になります。
var ittt = 0;
var add = null;
function MinuteTimer() {
add = setInterval(function () {
totime();
if (ittt % (40 * 60) == 0) {
ittt = 0;
}
}, 5);
};
function stoptimer() {
clearInterval(add);
};
function totime() {
drawcanvasbackground();
drawnumberscanvas(ittt);
ittt += 1;
if (ittt % 40 == 0 && ittt > 0) {
clearInterval(add);
setTimeout(MinuteTimer(), 800);
};
};