I follow the tutorial at: http://www.html5canvastutorials.com/tutorials/html5-canvas-lines/
My problem is that the line turned out to be blurry, and not solid and beautiful, as on the website.
here is the code:
var canvas = document.getElementById("rightSide");
var context = canvas.getContext("2d");
context.beginPath();
context.moveTo(50, 100);
context.lineTo(200, 100);
context.stroke();
width:200px;
padding:15px;
background:#eee;
border:1px solid #aaa;
float: left;
}
width:1000px;
height: 700px;
padding:15px;
background:#eee;
border:1px solid #aaa;
float: left;
margin:0px 0px 0px 20px;
}
<div id="leftSide">
<a class="trigger" href="#">Areas</a>
<ul class="level1">
<li><a href="http://www.google.com">Area 1</a></li>
<li><a href="#">Area 2</a></li>
<li><a href="#">Area 3</a></li>
<li><a href="#">Area 4</a></li>
<li><a href="#">Area 5</a></li>
<li><a href="#">Area 6</a></li>
</ul>
</div>
<canvas id="rightSide"></canvas>
thank
Edit: I actually found something very interesting, but I still don't understand how this happens. when I moved the canvas size coordinates from CSS to the tag, the line displays OK.
canvas id = "rightSide" width = "800px" height = "600px">
I would really like the explanation of what is happening here. Thank.
Gleeb source
share