level 3
刀剑灬笑傲
楼主
我绘制的图形和显示的不一样
代码部分:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
<style type="text/css">
#cav{
width:200px;
height:200px;
background-color:red;
}
</style>
<body>
<canvas id="cav"></canvas>
<script type="text/javascript">
var cav=document.getElementById("cav");
var pen=cav.getContext("2d");
pen.beginPath();
pen.fillStyle="#EFEFEF";
pen.strokeStyle="black";
pen.moveTo(0,0);
pen.lineTo(100,100);
pen.lineTo(0,100);
pen.fill();
pen.stroke();
pen.closePath();
</script>
</body>
</html>
界面部分:

感觉X轴的数值被减小了,Y轴的数值增大了.
我是用EditPlus写的.
2018年04月27日 07点04分
1
代码部分:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
<style type="text/css">
#cav{
width:200px;
height:200px;
background-color:red;
}
</style>
<body>
<canvas id="cav"></canvas>
<script type="text/javascript">
var cav=document.getElementById("cav");
var pen=cav.getContext("2d");
pen.beginPath();
pen.fillStyle="#EFEFEF";
pen.strokeStyle="black";
pen.moveTo(0,0);
pen.lineTo(100,100);
pen.lineTo(0,100);
pen.fill();
pen.stroke();
pen.closePath();
</script>
</body>
</html>
界面部分:

感觉X轴的数值被减小了,Y轴的数值增大了.我是用EditPlus写的.