HTML and CSS Reference
In-Depth Information
Code
Explanation
ctx.lineWidth = this.width;
ctx.strokeStyle = this.strokestyle;
ctx.beginPath();
ctx.moveTo(this.sx,this.sy);
ctx.lineTo(this.fx,this.fy);
ctx.stroke();
}
var mypent = new
Token(100,100,20,"rgb(0,0,250)",5);
everything.push(mypent);
function init(){
ctx = document.getElementById('canvas')
.getContext('2d');
window.addEventListener('keydown',
getkeyAndMove,false);
drawall();
}
function drawall() {
ctx.clearRect(0,0,cwidth,cheight);
var i;
for (i=0;i<everything.length;i++) {
everything[i].draw();
}
Search WWH ::




Custom Search