问题描述
function setTime(){
const now=new Date();
// second hand
const seconds=now.getSeconds();
const secondDegree=((seconds/60)*360+90);
const secondhand=document.querySelector('.sec-hand');
secondhand.style.transform=`rotate(${secondDegree}deg)`;
// minute hand
const minhand=document.querySelector('.min-hand');
const mins=now.getMinutes();
const minDegree=((mins/60)*360+90);
minhand.style.transform=`rotate(${minDegree}deg)`;
// hour hand
const hourhand=document.querySelector('.hour-hand');
const hour=now.getHours();
const hourDegree=((hour/12)*360+90);
hourhand.style.transform=`rotate(${hourDegree}deg)`;
}
setInterval(setTime,1000);
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)