DrawingTaiChiDiagramwithJavaScript

编程

<html>

<head>

<title>Canvas tutorial</title>

<style type="text/css">

canvas { border: 1px solid black; }

</style>

<script type="text/javascript" src="./draw.js" />

</head>

<body onload="draw();">

<canvas id="tutorial" width="150" height="150"></canvas>

</body>

</html>

draw.js

      function draw(){

var canvas = document.getElementById("tutorial");

if (canvas.getContext){

var ctx = canvas.getContext("2d");

ctx.beginPath();

ctx.arc(150, 50, 50, Math.PI*(1/2), Math.PI*(3/2), true);

ctx.stroke();

ctx.beginPath();

ctx.arc(150, 150, 50, Math.PI*(3/2), Math.PI*(1/2), true);

ctx.stroke();

ctx.beginPath();

ctx.arc(150, 100, 100, 0, Math.PI*2, true);

ctx.stroke();

}

}

以上是 DrawingTaiChiDiagramwithJavaScript 的全部内容, 来源链接: utcz.com/z/516017.html

回到顶部