zoukankan      html  css  js  c++  java
  • canvas绘制太极代码

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>canvas太极</title>
        <style type="text/css">
            canvas{background:#A9A9A0;}
        </style>
    </head>
    <body>
        <canvas id="mycanvas" width="800" height="600">
            您的浏览器暂不支持HTML5的canvas元素
        </canvas>
        <script type="text/javascript">
            var canvas=document.getElementById("mycanvas");
            var c=canvas.getContext('2d');
            c.strokeStyle="black";
            g=c.createLinearGradient(400,100,400,500);
            g.addColorStop(0,"white");
            g.addColorStop(1,"black");
            c.fillStyle=g;
            c.arc(400,200,100,Math.PI*3/2,Math.PI/2,true);
            c.arc(400,400,100,Math.PI*3/2,Math.PI/2);
            c.arc(400,300,200,Math.PI/2,Math.PI*3/2);
            c.fill();
    
            c.beginPath();
            g=c.createLinearGradient(400,100,400,500);
            g.addColorStop(0,"black");
            g.addColorStop(1,"white");
            c.fillStyle=g;
            c.arc(400,200,100,Math.PI*3/2,Math.PI/2,true);
            c.arc(400,400,100,Math.PI*3/2,Math.PI/2);
            c.arc(400,300,200,Math.PI/2,Math.PI*3/2,true);
            c.fill();
    
            c.beginPath();
            g=c.createRadialGradient(400,200,0,400,200,10);
            g.addColorStop(0,"black");
            g.addColorStop(1,"white");
            c.fillStyle=g;
            c.arc(400,200,10,0,Math.PI*2);
            c.fill();
    
            c.beginPath();
            g=c.createRadialGradient(400,400,0,400,400,10);
            g.addColorStop(0,"white");
            g.addColorStop(1,"black");
            c.fillStyle=g;
            c.arc(400,400,10,0,Math.PI*2);
            c.fill();
        </script>
    </body>
    </html>
    

      

  • 相关阅读:
    java 异常 检查型和非检查型
    【jdbc】spring
    [事务] spring
    【事务】spring transaction 注解
    【线程同步】 Java 同步块(synchronized)详细说明
    【图片二进制接受】php
    C# 读取EXCEL文件的三种经典方法
    RS232 3线制与7线制的区别
    修改android 开机画面
    win7 vs2012+wdk8.0 搭建wdf驱动开发环境
  • 原文地址:https://www.cnblogs.com/liao13160678112/p/6406963.html
Copyright © 2011-2022 走看看