HTML and CSS Reference
In-Depth Information
for (i=1;i<this.n;i++) {
For
loop for the
successive points
ctx.lineTo(this.sx+rad*Math.cos((i-
.5)*this.angle),this.sy+rad*Math.sin((i-.5)*this.angle));
Set up drawing of line
segments
}
Close
for
loop
ctx.fill();
Fill in the path
}
Close function
function drawback() {
Function header
ctx.fillStyle = backcolor;
Set card back color
ctx.fillRect(this.sx,this.sy,this.swidth,this.sheight);
Draw rectangle
}
Close function
function choose(ev) {
Function header for
choose
(click on a
card)
var mx;
Variable to hold
mouse
x
var my;
Variable to hold
mouse
y
var pick1;
Variable to hold
reference to created
Polygon
object
var pick2;
Variable to hold
reference to created
Polygon
object
if ( ev.layerX || ev.layerX == 0) {
Can we use
layerX
and
layerY
?
mx= ev.layerX;
Set
mx
Set
my
my = ev.layerY;