太极图动画

实现思路:

1.把这个圆看成是由两个长方体进行羽化而来,然后我们给它分别调成黑白两色(在大盒子里面再写两个大小一样的盒子,在排列上可以用浮动float,也可以用弹性盒子display:flex)

2.然后再写两个宽高为大圆一半的圆,通过定位把它们分别定位到圆中心垂直线上。

3.在两个小圆的盒子里面再分别添加上“眼睛”(小圆),具体实现代码如下所示。

在这里插入图片描述

太极图

<!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>太极图动画</title>
  <style>
    .circle {
      border: 1px solid #ccc;
      border-radius: 50%;
      width: 400px;
      height: 400px;
      margin: 100px auto;
      position: relative;
      animation: circle 5s linear infinite;
      display: flex;
    }

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

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

    .l {
      /* float: left; */
      width: 200px;
      height: 400px;
      background-color: #fff;
      border-top-left-radius: 200px;
      border-bottom-left-radius: 200px;
    }

    .r {
      /* float: right; */
      width: 200px;
      height: 400px;
      background-color: #000;
      border-top-right-radius: 200px;
      border-bottom-right-radius: 200px;
    }

    .c1 {
      width: 200px;
      height: 200px;
      background-color: #fff;
      position: absolute;
      border-radius: 50%;
      left: 100px;
      top: 0px;
    }

    .c2 {
      width: 200px;
      height: 200px;
      background-color: #000;
      position: absolute;
      border-radius: 50%;
      left: 100px;
      top: 200px;
    }

    .black {
      width: 50px;
      height: 50px;
      background-color: #000;
      border-radius: 50%;
      position: absolute;
      top: 78px;
      left: 64px;
    }

    .white {
      width: 50px;
      height: 50px;
      background-color: #fff;
      border-radius: 50%;
      position: absolute;
      top: 78px;
      left: 64px;
    }
  </style>
</head>

<body>
  <div class="circle">
    <div class="l"></div>
    <div class="r"></div>
    <div class="c1">
      <div class="black"></div>
    </div>
    <div class="c2">
      <div class="white"></div>
    </div>
  </div>
</body>

</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

心平气荷.

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

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

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

打赏作者

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

抵扣说明:

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

余额充值