html 绘制太极

太极的绘制主要需要用到5个圆,简易图解如下(简易绘制,凑合着看看):

具体代码如下:
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        .bigCircle{
            width: 200px;
            height: 200px;
            border: 1px black solid;
            border-radius: 100px;
            position: relative;
        }
        .leftCircle{
            width: 100px;
            height: 200px;
            border-bottom-left-radius: 100px;
            border-top-left-radius: 100px;
            background-color: black;
            float: left;
        }
        .rightCircle{
            width: 100px;
            height: 200px;
            border-bottom-right-radius: 100px;
            border-top-right-radius: 100px;
            background-color: white;
            float: left;
        }
        .topCircle{
            position: absolute;
            width: 100px;
            height: 100px;
            border-radius: 50px;
            top:0px;
            left: 50px;
            background-color: white;
        }
        .topSmallCircle{
            width: 20px;
            height: 20px;
            border-radius: 10px;
            margin: 40px;
            background-color: black;
        }
        .bottomCircle{
            position: absolute;
            width: 100px;
            height: 100px;
            border-radius: 50px;
            bottom:0px;
            left: 50px;
            background-color: black;
        }
        .bottomSmallCircle{
            width: 20px;
            height: 20px;
            border-radius: 10px;
            margin: 40px;
            background-color: white;
        }
    </style>
</head>
<body>
<div class="bigCircle">
    <div class="leftCircle"></div>
    <div class="rightCircle"></div>
    <div class="topCircle">
        <div class="topSmallCircle"></div>
    </div>
    <div class="bottomCircle">
        <div class="bottomSmallCircle"></div>
    </div>
</div>
</body>
</html>

效果图:
这里写图片描述

  • 8
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
Python可以使用多个绘图库进行太极图绘制,其中较为常用的是turtle库和matplotlib库。下面分别介绍这两种库的使用方法。 1. 使用turtle库绘制太极图 ```python import turtle # 设置画布大小和背景色 turtle.setup(500, 500) turtle.bgcolor('black') # 绘制白色半圆 turtle.fillcolor('white') turtle.begin_fill() turtle.circle(100, 180) turtle.end_fill() # 绘制黑色半圆 turtle.fillcolor('black') turtle.begin_fill() turtle.circle(100, -180) turtle.end_fill() # 绘制白色小圆 turtle.penup() turtle.goto(0, 50) turtle.pendown() turtle.fillcolor('white') turtle.begin_fill() turtle.circle(20) turtle.end_fill() # 绘制黑色小圆 turtle.penup() turtle.goto(0, -50) turtle.pendown() turtle.fillcolor('black') turtle.begin_fill() turtle.circle(20) turtle.end_fill() # 隐藏画笔 turtle.hideturtle() # 显示绘图窗口 turtle.done() ``` 2. 使用matplotlib库绘制太极图 ```python import matplotlib.pyplot as plt # 设置图形大小和分辨率 fig = plt.figure(figsize=(4, 4), dpi=100) # 绘制白色半圆 theta1 = [i for i in range(0, 181)] r1 = [100] * len(theta1) plt.polar(theta1, r1, color='white') # 绘制黑色半圆 theta2 = [i for i in range(180, 361)] r2 = [100] * len(theta2) plt.polar(theta2, r2, color='black') # 绘制白色小圆 plt.polar(0, 50, marker='o', markersize=10, color='white') # 绘制黑色小圆 plt.polar(0, -50, marker='o', markersize=10, color='black') # 隐藏极轴和刻度标签 plt.axis('off') # 显示绘图窗口 plt.show() ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值