canvas画出向上的箭头,通过这个例子更加详细的了解canvas
-
<!DOCTYPE html >
-
<html>
-
<head>
-
<title>cars</title>
-
<script src=""></script>
-
</head>
-
<body>
-
<canvas id ="canvas" width="200" height="200"></canvas>
-
<script>
-
var canvas = document.getElementById("canvas");
-
var ctx = canvas.getContext("2d");
-
ctx.fillStyle = "SkyBlue";
-
ctx.lineWidth = 4;
-
ctx.beginPath();
-
ctx.moveTo(100,100);
-
ctx.lineTo(100,60);
-
ctx.lineTo(130,30);
-
ctx.lineTo(160,60);
-
ctx.lineTo(160,100);
-
ctx.lineTo(100,100);
-
ctx.fill();
-
</script>
-
</body>
-
</html>
阅读(705) | 评论(0) | 转发(0) |