2D动画速度细节

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            /* 让超出的文字自动隐藏 */
            font-size: 20px;
            overflow: hidden;
            width: 0;
            height: 30px;
            background-color: pink;
            /* animation: name duration timing-function delay iteration-count direction fill-mode; */
            /* line是匀速,ease是先慢然后加速再变慢的一个过程,steps()步长数量完成; */
            animation: walk 5s steps(5) infinite;
            /* 强制文字在一行内显示 */
            white-space: nowrap;
        }
        /* 先定义动画状态 */
        
        @keyframes walk {
            0% {}
            100% {
                width: 150px;
            }
        }
    </style>
</head>

<body>
    <div>12345678910</div>
</body>

</html>

在这里插入图片描述
在这里插入图片描述

发布了68 篇原创文章 · 获赞 1 · 访问量 1020

猜你喜欢

转载自blog.csdn.net/weixin_42378409/article/details/104966376