Canvas

Vytvorenie

var canvas = document.crea­teElement(‚can­vas‘); canvas.setAttri­bute(‚width‘,500); canvas.setAttri­bute(‚height‘,500); document.getE­lementById(‚can­vasDiv‘).appen­dChild(canvas);

var ctx = canvas.getCon­text(‚2d‘); ctx.fillStyle = „rgb(200,50,0)“; ctx.fillRect(0, 10, 55, 50);

Metódy

canvas.getBou­ndingClientRec­t()

Vrati polohu a rozmery

bottom height left right top width

styles and colors

ctx.fillStyle = „orange“;
ctx.fillStyle = „#FFA500“;
ctx.fillStyle = „rgb(255,165,0)“;
ctx.fillStyle = „rgba(255,165­,0,1)“;