时钟案例
作者:
複製粘貼 | 来源:发表于
2018-01-16 17:29 被阅读0次function changeTime() {
//获取事件,创建日期对象
var date = new Date();
console.log(date);
//获取时分秒
// var ms =date.getMilliseconds();
var sec = date.getSeconds(); //+ ms / 1000;
var min = date.getMinutes();
console.log (sec, min);
var hr = date.getHours()+ min/60;
console.log(hr);
//动画
second.style.transform = 'rotate(' + 6 * sec +'deg)';
minute.style.transform ='rotate(' + 6 * min +'deg)';
hour.style.transform = 'rotate(' + 30 * hr +'deg)';
}
changeTime();
var time = setInterval(changeTime,1000);
console.log(time);
本文标题:时钟案例
本文链接:https://www.haomeiwen.com/subject/gjqeoxtx.html
网友评论