美文网首页
canvas和svg:圆

canvas和svg:圆

作者: 0清婉0 | 来源:发表于2021-04-22 20:35 被阅读0次

canvas

<canvas id="myCanvas" width="200" height="100">

Your browser does not support the canvas element.

</canvas>

<script type="text/javascript">

var c=document.getElementById("myCanvas");

var cxt=c.getContext("2d");

cxt.fillStyle="#FF0000";

cxt.beginPath();

cxt.arc(70,18,15,0,Math.PI*2,true);

cxt.closePath();

cxt.fill();

</script>

svg

<?xml version="1.0" standalone="no"?>

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"

"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">

    <circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red"/>

</svg>

相关文章

网友评论

      本文标题:canvas和svg:圆

      本文链接:https://www.haomeiwen.com/subject/eswfrltx.html