账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    css animation返回第一帧会有明显的移动,如何解决?
    51
    0
    同一个滚动效果,用js的requestAnimationFrame控制返回初始态非常自然,没有痕迹,但是用css animation控制,则回到第一帧,会有明显的下移动作,这个问题能否解决?在线demo关键代码如下:css animation版本:.m-tb-scroll tbody{display:block}.m-tb-scroll tbody.scroll{height:850px;overflow:hidden;overflow-y:scroll}.m-tb-scroll thead,.m-tb-scroll tbody tr{display:table;width:100%;table-layout:fixed}.m-tb-scroll tbody.ani{ animation:scroll var(--scrollDuration) linear both infinite; animation-play-state:var(--scrollPause)}@keyframes scroll{ 0%{transform:translateY(var(--scrollTopDebounce))} 100%{transform:translateY(var(--scrollY))}}if(scroll > 10){ scroll += this.bottomDebounce; target.classList.remove('scroll'); target.classList.add('ani'); console.log('scroll: ', scroll); let scrollDuration = scroll/60; document.body.style.setProperty('--scrollDuration', `${scrollDuration}s`); document.body.style.setProperty('--scrollY', `-${scroll}px`); document.body.style.setProperty('--scrollTopDebounce', `${this.topDebounce}px`); this.setAnimationPause();}else{ target.classList.remove('ani');}js版本if (scroll > 10) { target.classList.remove('scroll'); requestAnimationFrame(animate); let step = 0; function animate() { if (self.stop) return; console.log('puase: ', self.pause); if(!self.pause){ if (step >= scroll) { step = 0; } else { step += 1; } target.style.transform = `translateY(-${step}px)` } requestAnimationFrame(animate); }} else { self.stop = true; target.style.transform = `translateY(0)`}
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 笑傲苍生 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部