太极图用html做的原理,用HTML画个太极图

您所在的位置:网站首页 html5做个太极图 太极图用html做的原理,用HTML画个太极图

太极图用html做的原理,用HTML画个太极图

2024-01-23 09:06| 来源: 网络整理| 查看: 265

无标题文档

window.onload = function(){

var ctx = document.getElementByIdx_x_x_x("pic").getContext('2d');

//绘制白色半圆的代码如下:

ctx.beginPath();

ctx.arc(200,200,80,1.5*Math.PI,Math.PI/2,false);

ctx.fillStyle="white";

ctx.closePath();

ctx.fill();

//绘制黑色半圆的代码如下:

ctx.beginPath();

ctx.arc(200,200,80,Math.PI/2,1.5*Math.PI,false);

ctx.fillStyle="black";

ctx.closePath();

ctx.fill();

//绘制黑色小圆

ctx.beginPath();

ctx.arc(200,240,40,0,Math.PI*2,true);

ctx.fillStyle="black";

ctx.closePath();

ctx.fill();

//绘制白色小圆

ctx.beginPath();

ctx.arc(200,160,40,0,Math.PI*2,true);

ctx.fillStyle="white";

ctx.closePath();

ctx.fill();

//绘制白色小圆心

ctx.beginPath();

ctx.arc(200,160,5,0,Math.PI*2,true);

ctx.fillStyle="black";

ctx.closePath();

ctx.fill();

//绘制黑色小圆心

ctx.beginPath();

ctx.arc(200,240,5,0,Math.PI*2,true);

ctx.fillStyle="white";

ctx.closePath();

ctx.fill();

//绘制文字代码如下:

ctx.save();

ctx.fillStyle="black";

ctx.globalAlpha="0.4";

ctx.textAlign="center";

ctx.font="32px Arial";

ctx.shadowColor="rgba(0,0,0,0.4)";

ctx.shadowOffsetX=15;

ctx.shadowOffsetY=-10;

ctx.shadowBlur=2;

ctx.fillText('Hello Canavs',200,100);//IE不支持

ctx.restore();

}



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3