CSS 文字抖动特效

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="wavy"> 
        <span style="--i:1">1</span> 
        <span style="--i:2">3</span>
        <span style="--i:3">m</span>
        <span style="--i:4">i</span>
        <span style="--i:5">i</span>
        <span style="--i:6">k</span>
        <span style="--i:7">i</span>
        <span style="--i:8">.</span>
        <span style="--i:9">c</span>
        <span style="--i:10">o</span>
        <span style="--i:11">m</span>
    </div>
</body>
</html>

CSS

*{
    padding: 0;
    margin: 0;
    font-family: consolas;
}
body{
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}
.wavy{
    position: relative;
    -webkit-box-reflect:below -12px linear-gradient(transparent,rgba(0,0,0,0.2));/*倒影*/
}
.wavy span{
    position: relative;
    display: inline-block;
    color: #fff;
    font-size: 3em;
    font-weight: 900;
    text-transform: uppercase;
    animation:animate 1s ease-in-out infinite;
    animation-delay:calc(0.1s *var(--i)) ;
}
@keyframes animate{
    0%{
        transform: translateY(0px);
    }
    20%{
        transform: translateY(-20px);
    }
    40%,100%{
        transform: translateY(0px);
    }
}

 

点赞