HTML and CSS Reference
In-Depth Information
Code
Explanation
var doty;
Variable to be used for the vertical position for
drawing the two dots
ctx.beginPath();
Begin path
dotx = dx + 3*dotrad;
Position the dots to be just inside horizontally
doty = dy + .5*diceheight;
and midway vertically
ctx.arc(dotx,doty,dotrad,0,Math.
PI*2,true);
Construct circle
dotx = dx+dicewidth-3*dotrad;
Position this dot to be just inside the right
border
doty = dy + .5*diceheight;
//no change
Position y midway
ctx.arc(dotx,doty,dotrad,0,Math.
PI*2,true);
Construct circle
ctx.closePath();
Close path
ctx.fill();
Draw dots
}
Close draw2mid function
</script>
Close script element
</head>
Close head element
<body>
Starting body tag
<canvas id="canvas" width="400" height="300"> Canvas tag start
Your browser doesn't support the HTML5
element canvas.
Set up canvas and provide notice if browser
doesnt accept canvas element
</canvas>
Close canvas tag
<br/>
Line break
Search WWH ::




Custom Search