Home > front end >  HTML 5 canvas, draw two lines do not display
HTML 5 canvas, draw two lines do not display

Time:05-14

For bosses to give directions!!!!!



<meta charset="utf-8">
<meta HTTP - equiv=X - UA - Compatible "content=" IE=edge, chrome="1"/& gt;
The canvas & lt;/title> <br/><br/></head> <br/><br/><body> <br/><Canvas width="600" height="450" style="border: 1 px solid # 09 f; Margin - left: 10%; Margin - top: 10%; 10% margin - bottom: "& gt; </canvas> <br/><The script type="text/javascript" & gt; <br/>Var canvas=document. GetElementById (" canvas "); <br/>Var context=canvas. GetContext (" 2 d "); <br/>The context. BeginPath (); <br/># context. StrokeStyle="red"; <br/>The context. MoveTo (10, 10); <br/>The context. The lineTo (200150); <br/>The context. The stroke (); <br/>The context. The closePath (); <br/><br/>The context. BeginPath (); <br/>The context. StrokeStyle="red"; <br/>The context. MoveTo (10, 20); <br/>The context. The lineTo (200160); <br/>The context. The stroke (); <br/>The context. The closePath (); <br/><br/>The context. Our lineWidth='10 px; <br/>The context. LineCap=square; <br/>The context. The lineJoin=bevel; <br/>The context. The fillStyle="blue"; <br/>The context. The fill (); <br/></script> <br/></body> <br/><html><p class="article - content rp"> CodePudding user response: </p><pre> <br/><! DOCTYPE html> <br/><HTML lang="en" & gt; <br/><head> <br/><meta charset="utf-8" & gt; <br/><meta HTTP - equiv="X - UA - Compatible" content="IE=edge" & gt; <br/><meta name="viewport" content="width=device - width, initial - scale=1.0" & gt; <br/><title> Document


<body>
Style="border: 1 px solid # 09 f; Margin - left: 10%; Margin - top: 10%; 10% margin - bottom: "& gt;

Var canvas=document. GetElementById (" canvas ");
var context=canvas.getContext("2d");
The context. BeginPath ();
# context. StrokeStyle="red";
Context. MoveTo (10, 10);
The context. The lineTo (200, 150);
The context. The stroke ();
The context. The closePath ();

The context. BeginPath ();
The context. StrokeStyle="red";
Context. MoveTo (10, 20);
The context. The lineTo (200, 160);
The context. The stroke ();
The context. The closePath ();

The context. Our lineWidth='10 px;
The context, lineCap='square';
The context. The lineJoin='bevel';
The context. The fillStyle="blue";
The context. The fill ();
</script>



Point with your heart
  • Related