您好,欢迎访问代理记账网站
  • 价格透明
  • 信息保密
  • 进度掌控
  • 售后无忧

CSS:吃豆子动画

主要用到了CSS3动画以及CSS3 转换。

代码如下:

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            margin: 50px 50px;
            position: relative;
            width: 350px;
            height: 200px;
        }
        .head {
            position: relative;
            width: 200px;
            height: 200px;
            background-color: white;
            border-radius: 50%;
            overflow: hidden;
        }
        .head::before,
        .head::after {
            position: absolute;
            z-index: 1;
            left: 0;
            content: '';
            width: 200px;
            height: 100px;
            background-color: orangered;
        }
        .head::before {
            top: 0;
            transform-origin: 100px 100px;
            animation: top .5s linear infinite alternate;
        }
        .head::after {
            top: 100px;
            transform-origin: 100px 0px;
            animation: bottom .5s linear infinite alternate ;
        }
        .dot {
            position: absolute;
            left: 100px;
            top: 50%;
            transform: translateY(-50%);
            width: 15px;
            height: 15px;
            border-radius: 50%;
            background-color: red;
            box-shadow: 50px 0 0 orange, 100px 0 0 orange, 150px 0 0 orange,200px 0 0 orange;
            animation: eat .5s linear infinite;
        }
        @keyframes top {
            0% {
                transform: rotate(-30deg);
            }
            100% {
                transform: rotate(0deg);
            }
        }
        @keyframes bottom {
            0% {
                transform: rotate(30deg);
            }
            100% {
                transform: rotate(0deg);
            }
        }
        @keyframes eat {
            100% {
                left: 0;
            }
        }
    </style>
</head>
<body>
        <div class="box">
            <div class="head"></div>
            <div class="dot"></div>
        </div>
</body>
</html>

效果图:


分享:

低价透明

统一报价,无隐形消费

金牌服务

一对一专属顾问7*24小时金牌服务

信息保密

个人信息安全有保障

售后无忧

服务出问题客服经理全程跟进