SVG绘制太极图

时间:2023-03-08 16:59:32
SVG绘制太极图

思路:先画一整个圆,填充颜色为黑色,再用一个边框和填充颜色均为白色的长方形覆盖右半边的半圆,再以同一个圆心,相同半径绘制一整个圆,该圆的边线颜色为黑色,没有填充颜色,最后常规操作再画四个小圆

源代码:

<!doctype html>
<html>
<head>
<title>test</title>
<meta charset="UTF-8">
</head>
<body>
<svg id="svg" width=600px height=600px >
<circle cx="100" cy="100" r="100" fill="black" stroke="black"></circle>
<polygon points="100,0 200,0 200,200 100,200 100,0" stroke="white" fill="white"></polygon>
<circle cx="100" cy="100" r="100" fill="none" id="circle2" stroke="black"></circle>
<circle cx="100" cy="50" r="50" fill="white" stroke="none"></circle>
<circle cx="100" cy="150" r="50" fill="black" stroke="none"></circle>
<circle cx="100" cy="50" r="20" fill="black" stroke="black"></circle>
<circle cx="100" cy="150" r="20" fill="white" stroke="black"></circle>
</svg> <script>
</script>
</body>
</html>