css实现太极图

html 复制代码
<template>
  <div>
    <!-- 太极图 -->
    <div class="all">
      <div class="left box"></div>
      <div class="right box"></div>
      <div class="black">
        <div class="inner_white"></div>
      </div>
      <div class="white">
      <div class="inner_black"></div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {};
  },
  watch: {},
  created() {},
  methods: {},
};
</script>
<style lang='less' scoped>
.all{
  border:5px solid black;
  border-radius: 50%;
  width: 300px;
  height: 300px;
  margin:0 auto;
  margin-top:15%;
  overflow: hidden;
  display: flex;
  position: relative;

  animation: action 5s linear infinite;
  .box{
    width: 50%;
    height: 100%;

  }
  .left{
    background: #fff;
  }
  .right{
    background: #000;
  }
  .black{
    background: #000;
    width: 145px;
    height: 145px;
    border-radius: 50%;
    box-sizing: border-box;
    position: absolute;
    left:50%;
    margin-left: -75px;
    display: flex;
    align-items: center;
    justify-content: center;
    .inner_white{
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: #fff;

    }
  }
  .white{
    background: #fff;
    width: 145px;
    height: 145px;
    border-radius: 50%;
    box-sizing: border-box;
    position: absolute;
    left:50%;
    bottom:0;
    margin-left: -75px;
    display: flex;
    align-items: center;
    justify-content: center;
    .inner_black{
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: #000;

    }
  }
}

@keyframes action {
  0%{
    transform: rotate(0);
  }
  25%{
    transform: rotate(-90deg);
  }
  50%{

    transform: rotate(-180deg);
  }
  75%{
    transform: rotate(-270deg);
  }
  100%{
    transform: rotate(-360deg);
  }
}
</style>
相关推荐
韩曙亮2 分钟前
【Web APIs】移动端轮播图案例 ( 轮播图自动播放 | 设置无缝衔接滑动 | 手指滑动轮播图 | 完整代码示例 )
前端·javascript·css·html·轮播图·移动端·web apis
犬大犬小7 分钟前
Web 渗透:如何绕过403 Forbidden? Part I
前端·安全性测试·web 安全
AI前端老薛20 分钟前
面试:了解闭包吗?
前端
xu_duo_i34 分钟前
vue3+element-plus图片上传,前端压缩(纯函数,无插件)
前端·javascript·vue.js
林恒smileZAZ37 分钟前
在 Web 前端实现流式 TTS 播放
前端
睡不着的可乐38 分钟前
前端优化:requestAnimationFrame vs setInterval 性能对比与实战
前端
C_心欲无痕42 分钟前
nodejs - npm serve
前端·npm·node.js
释怀不想释怀1 小时前
web前端crud (修改,删除)
前端
IT_陈寒1 小时前
JavaScript性能优化:7个被低估的V8引擎技巧让你的代码提速50%
前端·人工智能·后端
bigHead-1 小时前
前端双屏显示与通信
开发语言·前端·javascript