While I have the fundamental understanding of code, I have made some small stride forward through trial and error. I have been working on the ARC and still have some questions on the code, but I am optimistic. I have decided to recreate the code from beginning based on the tutorial so get used to the type of structure that is needed to recreated it accurately.
I started by copying and pasting the entire code into Dreamweaver and slowly picking it apart..I am still working on it; I have highlighted items which I am unsure and have questions about this evening
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px; - " OPX" This code wasnt explained on the tutorial
padding: 0px;
}
#myCanvas {
border: 1px solid #9C9898; - Not sure about this
}
</style>
<script>
window.onload = function() {
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
var x = canvas.width / 2;
var y = canvas.height / 2;
var radius = 75;
var startAngle = 1.1 * Math.PI;
var endAngle = 1.9 * Math.PI;
var counterClockwise = false;
context.beginPath(); - Do I always need to begin any Shape with " beginPath" or just circles / arches ?
context.arc(x, y, radius, startAngle, endAngle, counterClockwise);
context.lineWidth = 15;
// line color
context.strokeStyle = "black";
context.stroke();
};
</script>
</head>
<body>
<canvas id="myCanvas" width="578" height="250"></canvas>
</body>
</html>
No comments:
Post a Comment