简单实现一个数据未加载前的动画

博客分享了Google旗下YouTube的iOS端相关效果,作者表示不废话直接上代码,还提到掘金似乎也有相关内容,最后给出了转载链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

先来看一下效果

不废话了,直接上代码

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

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .test {
            width: 400px;
            height: 20px;
            text-align: center;
            margin-bottom: 20px;
        }

        #gradent {
            background: -webkit-gradient(linear, left top, right top,
                        color-stop(0, #bdbdbd),
                        color-stop(.3, #c3c3c3),
                        color-stop(.5, #fff),
                        color-stop(.7, #c3c3c3),
                        color-stop(1, #bdbdbd));
            -webkit-animation: slidetounlock 1s infinite;
            line-height: 20px;
            display: inline-block;
            width: 100%;
        }

        @keyframes slidetounlock {
            0% {
                background-position: -200px 0
            }

            100% {
                background-position: 200px 0
            }
        }
    </style>
</head>

<body>
    <div class="test">
        <span id="gradent"> &nbsp; </span>
    </div>
    <div class="test">
        <span id="gradent"> &nbsp; </span>
    </div>
    <div class="test">
        <span id="gradent"> &nbsp; </span>
    </div>
    <div class="test">
        <span id="gradent"> &nbsp; </span>
    </div>

</body>

</html>
复制代码

个人第一次看见是在Google旗下yootube 的ios端,好像掘金也有了,嗯,自己玩一下。

转载于:https://juejin.im/post/5cde2f1c51882525d71046ba

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值