Uncategorized

HTML5 canvas

HTML5 CANVAS ELEMENT Html5 canvas element <canvas id=”myCanvas” width=”500″ height=”300″> Html5 canvas element with fallback content <canvas id=”myCanvas” width=”500″ height=”300″> your browser doesn’t support canvas! </canvas> 2d context var context = canvas.getContext(‘2d’); Webgl context (3d) var context = canvas.getContext(‘webgl’); SHAPES Draw rectangle context.rect(x, y, width, height); context.fill(); context.stroke(); Fill rectangle shorthand context.fillRect(x, y, width, height);… Continue reading HTML5 canvas