js实现range数字滑动与输入动画显示效果代码

代码语言:html

所属分类:其他

代码描述:js实现range数字滑动与输入动画显示效果代码

代码标签: js range 数字 滑动 输入 动画 显示

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
  
<style>
@import "https://unpkg.com/open-props/easings.min.css";
@import "https://unpkg.com/open-props/animations.min.css";

@layer demo {
  [id="$demo"] > :nth-child(1 of span) { view-transition-name: n1 }
  [id="$demo"] > :nth-child(2 of span) { view-transition-name: n2 }
  [id="$demo"] > :nth-child(3 of span) { view-transition-name: n3 }
  [id="$demo"] > :nth-child(4 of span) { view-transition-name: n4 }
  
  [id="$demo"] > comma { view-transition-name: output-comma }
  output > sup         { view-transition-name: output-prefix }
  
  @media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(n1),
    ::view-transition-old(n2),
    ::view-transition-old(n3),
    ::view-transition-old(n4),
    ::view-transition-old(output-comma):only-child {
      inline-size: -webkit-fit-content;
      inline-size: -moz-fit-content;
      inline-size: fit-content;
      -webkit-animation: 
        var(--animation-fade-out) forwards,
        var(--animation-slide-out-up) forwards;
              animation: 
        var(--animation-fade-out) forwards,
        var(--animation-slide-out-up) forwards;
    }
    
    ::view-transition-old(n1):only-child,
    ::view-transition-old(n2):only-child,
    ::view-transition-old(n3):only-child,
    ::view-transition-old(n4):only-child {
      display: none;
    }

    ::view-transition-new(n1),
    ::view-transition-new(n2),
    ::view-transition-new(n3),
    ::view-transition-new(n4),
    ::view-transition-new(output-comma):only-child {
      -webkit-animation: 
        var(--animation-fade-out) reverse,
        var(--animation-slide-in-up);
              animation: 
        var(--animation-fade-out) reverse,
        var(--animation-slide-in-up);
    }
    
    /* stagger with an increased animation duration */
    ::view-transition-old(n1), 
    ::view-transition-new(n1) {
      -webkit-animation-duration: .5s;
              animation-duration: .5s;
    }
    
    ::view-transition-old(n2), 
    ::view-transition-new(n2) {
      -webkit-animation-duration: .6s;
              animation-duration: .6s;
    }
    
    ::view-transition-old(n3),
    ::view-transition-new(n3) {
      -webkit-animation-duration: .7s;
              animation-duration: .7s;
    }
    
    ::view-transition-old(n4),
    ::view-transition-new(n4) {
      -webkit-animation-duration: .8s;
              animation-duration: .8s;
    }
  }
}

@layer demo.support {
  * {
    box-sizing: borde.........完整代码请登录后点击上方下载按钮下载查看

网友评论0