第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

緩沖動畫的問題

經(jīng)常直接飛到屏幕上面看不見了。那個時間的代碼可以忽視了,是正常的, 我是做了倒計時的第一節(jié)課跳過來做緩沖動畫的……

還有就是緩沖的原理雖然知道了,但是計算方式還是很暈

<!DOCTYPE?html>
<html>
<head?lang="en">
????<meta?charset="UTF-8">
????<title></title>
????<script>
????????window.onload=function()?{
????????????showTimes();
????????}
????????function?timeCheck(i){
????????????if(i<10){
????????????????i="0"+i;
????????????}
????????????return?i;
????????}
????????function?showTimes(){
????????????var?main=document.getElementsByTagName("div")[0];
????????????var?sp=document.getElementById("sp");
????????????var?timeShow=new?Date();
????????????var?y=timeShow.getFullYear();
????????????var?m=timeShow.getMonth();
????????????var?d=timeShow.getDate();
????????????var?w=timeShow.getDay();
????????????var?hou=timeCheck(timeShow.getHours());
????????????var?min=timeCheck(timeShow.getMinutes());
????????????var?sec=timeCheck(timeShow.getSeconds());
????????????var?week=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
????????????var?weekShow=week[w];

????????????sp.innerHTML="當(dāng)前時間:"+y+"年"+m+"月"+d+"日?"+weekShow+"?"+hou+":"+min+":"+sec;
????????????var?t=setTimeout('showTimes()',500);
????????????main.onmouseover=function(){sportsTop(0)}
????????????main.onmouseout=function(){sportsTop(-50)}
????????}
????????var?timer=null;
????????function?sportsTop(tops){
????????????clearInterval(timer);
????????????var?main=document.getElementsByTagName("div")[0];
????????????var?spe=(tops-main.offsetTop)/5;
????????????spe=spe>0?Math.ceil(spe):Math.floor(spe);
????????????timer=setInterval(function(){
????????????????if(main.offsetTop==tops){
????????????????????clearInterval(timer);
????????????????}else{
????????????????????main.style.marginTop=main.offsetTop+spe+"px";
????????????????}
????????????},20);
????????}
????</script>

????<style>
????????*{
????????????padding:0;margin:0;
????????????font-family:?"微軟雅黑";
????????}
????????div{
????????????position:relative;
????????????top:0;
????????????left:0;
????????????box-shadow:0px?0px?7px?0px?#a3a3a3;
????????????width:400px;
????????????height:60px;
????????????border-bottom-left-radius:?20px;
????????????border-bottom-right-radius:?20px;
????????????text-align:?center;
????????????cursor:default;
????????????background-color:?#e4ffc8;
????????}
????????span{
????????????position:relative;
????????????line-height:60px;
????????????color:?#aaaaaa;

????????}
????</style>
</head>
<body>
????<div>
????????<span?id="sp">

????????</span>
????</div>
</body>
</html>


正在回答

1 回答

function getStyle(obj,attr)

{

if(obj.currentStyle){

return obj.currentStyle[attr];//currentStyle 針對IE瀏覽器

}else{

return getComputedStyle(obj,false)[attr];//getComputedStyle 針對firefox瀏覽器

}

}

????????var?timer=null;
????????function?sportsTop(tops){
????????????clearInterval(timer);
????????????var?main=document.getElementsByTagName("div")[0];
????????????var?icur?=?parseInt(getStyle(main,'marginTop'));
????????????var?spe=(tops-icur)/5;
????????????spe=spe>0?Math.ceil(spe):Math.floor(spe);
????????????timer=setInterval(function(){
????????????????if(icur==tops){
????????????????????clearInterval(timer);
????????????????}else{
????????????????????main.style.marginTop=icur+spe+"px";
????????????????}
????????????},20);
????????}


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
JS動畫效果
  • 參與學(xué)習(xí)       113920    人
  • 解答問題       1487    個

通過本課程JS動畫的學(xué)習(xí),從簡單動畫開始,逐步深入各種動畫框架封裝

進(jìn)入課程

緩沖動畫的問題

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號