【animate】animate 动画 -- 旋转的太极图

本文介绍了一个使用HTML和CSS实现的旋转八卦盘动画效果。通过关键帧动画,八卦盘上的黑白半圆和小圆圈会围绕中心旋转,形成有趣的视觉效果。代码中详细展示了如何设置背景颜色、布局和动画。

效果 GIF

gif

在线效果

代码

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>

    <style>
        * {
            box-sizing: border-box;
        }

        body {
            background-color: aqua;
        }

        .warpper {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }

        .circle {
            border-radius: 50%;
        }

        .black {
            background-color: black;
        }

        .white {
            background-color: white;
        }

        .gossip {
            position: relative;
            width: 400px;
            height: 400px;
            overflow: hidden;
            animation: rotating 1s infinite linear;
        }

        @keyframes rotating {
            from {
                transform: rotate(0deg);
            }

            to {
                transform: rotate(360deg);
            }
        }

        .semicircle {
            width: 50%;
            height: 100%;
        }

        .semicircle.left {

            position: absolute;
            left: 0;
        }

        .semicircle.right {
            position: absolute;
            right: 0;
        }

        .big {
            width: 50%;
            height: 50%;
        }

        .small {
            width: 10%;
            height: 10%;
        }

        .big.bottom {
            width: 50%;
            height: 50%;
            position: absolute;
            bottom: 0;
            left: 50%;
            margin-left: -25%;
        }

        .big.top {
            position: absolute;
            top: 0;
            left: 50%;
            margin-left: -25%;
        }

        .small.top {
            position: absolute;
            top: 25%;
            left: 50%;
            margin-top: -5%;
            margin-left: -5%;
        }

        .small.bottom {
            position: absolute;
            bottom: 25%;
            right: 50%;
            margin-bottom: -5%;
            margin-right: -5%;
        }
    </style>
</head>

<body>
    <div class="warpper">
        <div class="gossip circle">
            <div class="semicircle left black"></div>
            <div class="semicircle right white"></div>
            <div class="circle big top black"></div>
            <div class="circle big bottom white"></div>
            <div class="circle small top white"></div>
            <div class="circle small bottom black"></div>
        </div>
    </div>
</body>

</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

HolaSecurity

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值