当前位置: 首页 > news >正文

做一个有天有地的css及html画的旋转阴阳鱼

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>天地阴阳</title>
    <style>
        /* 重置默认样式 */
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }

        /* 基础布局 */
        html, body {
            height: 100%;
        }

        .container {
            height: 100%;
            display: flex;
            flex-direction: column;
            position: relative;
        }

        /* 天地背景 */
        .sky {
            flex: 1;
            background: linear-gradient(to bottom, #87CEEB, #E0F6FF);
        }

        .earth {
            height: 50%;
            background: linear-gradient(to bottom, #90EE90, #228B22);
        }

        /* 八卦图主容器 */
        .box {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            width: 300px;
            height: 300px;
            border-radius: 50%;
            box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
            animation: rotate 8s linear infinite;
            transform-origin: center center;
            backdrop-filter: blur(5px);
            /* 移除重复的样式定义和背景色 */
        }

        /* 阴阳鱼左右半圆 */
        .semi-circle {
            position: absolute;
            height: 100%;
            width: 50%;
        }

        .left {
            left: 0;
            background: #000;
            border-radius: 150px 0 0 150px;
            width: 50%;
        }

        .right {
            right: 0;
            background: #fff;
            border-radius: 0 150px 150px 0;
            width: 50%;
        }

        /* 在box容器中添加背景色 */
        .box {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            width: 300px;
            height: 300px;
            border-radius: 50%;
            box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
            animation: rotate 8s linear infinite;
            transform-origin: center center;
            backdrop-filter: blur(5px);
            background: rgba(255, 255, 255, 0.8);  /* 添加背景色 */
        }

        /* 阴阳鱼大圆 */
        .circle {
            position: absolute;
            left: 25%;
            width: 50%;
            height: 50%;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .top-circle {
            top: 0;
            background: #000;  /* 改为纯黑色 */
        }

        .bottom-circle {
            bottom: 0;
            background: #fff;  /* 改为纯白色 */
        }

        /* 阴阳眼 */
        .small-circle {
            width: 30px;
            height: 30px;
            border-radius: 50%;
        }

        .white { background: #fff; }  /* 改为纯白色 */
        .black { background: #000; }  /* 改为纯黑色 */

        /* 旋转动画 */
        @keyframes rotate {
            from { transform: translate(-50%, -50%) rotate(0deg); }
            to { transform: translate(-50%, -50%) rotate(360deg); }
        }

        /* 悬停效果 */
        .box:hover {
            animation-play-state: paused;
            box-shadow: 0 0 40px rgba(0, 0, 0, 0.4);
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="sky"></div>
        <div class="earth"></div>
        <div class="box">
            <div class="semi-circle left"></div>
            <div class="semi-circle right"></div>
            <div class="circle top-circle">
                <span class="small-circle white"></span>
            </div>
            <div class="circle bottom-circle">
                <span class="small-circle black"></span>
            </div>
        </div>
    </div>
</body>
</html>

相关文章:

  • Next.js中not-found.js触发方式详解
  • Unity Render Streaming项目之Multiplay经验
  • 【构建CV图像识别系统】从传统方法到深度学习
  • LangChain组件Tools/Toolkits详解(5)——返回产出artifact
  • 蓝桥杯真题 2109.统计子矩阵
  • 蓝桥杯备考-》单词接龙
  • bug:uni-file-picker上传图片报错,文件选择器对话框只能在由用户激活时显示,跨域cors
  • 用PostgreSQL玩转俄罗斯方块:当SQL成为游戏引擎
  • SpringBoot中安全的设置阿里云日志SLS的accessKey
  • RAG优化:python从零实现长上下文压缩技术
  • MySQL中DDL、DML、DQL、DCL四种语言详细介绍
  • SpringBoot-3-JWT令牌
  • Js 垃圾回收 与 内存泄漏
  • java当中的list集合
  • 第十四天- 排序
  • 轻量级TLS反向代理工具TLS-reverse-proxy:打造安全通信桥梁
  • 基于springboot的校园资料分享平台(048)
  • 307 Temporary Redirect 解决办法 httpx
  • 如何安全解除PDF文件密码?实测免费工具操作指南
  • Live555+Windows+MSys2 编译Androidso库和运行使用
  • 中美大幅下调超100%关税,印巴四日“战争”复盘|907编辑部
  • 韩国总统选战打响:7人角逐李在明领跑,执政党临阵换将陷入分裂
  • 新造古镇丨乌镇的水太包容了,可以托举住任何一种艺术
  • 基因编辑技术让蜘蛛吐彩丝
  • 牛市早报|中美经贸高层会谈达成重要共识,取得实质性进展
  • 7月打卡乐高乐园,还可以去千年古镇枫泾参加这个漫画艺术季