HTML/Canvas
外觀
< HTML
<canvas> tag允許腳本化地繪製2D形狀。
繪製一個Canvas:
<canvas id="e">This text will be displayed if the browser does not support canvas.</canvas>
JavaScript
var Canvas=document.getElementById("e");
var Context=Canvas.getContext("2d");
context.fillStyle="green";
context.fillRect(30,40,30,20);
context.strokeStyle="red";
context.strokeRect(30,40,30,20);
context.strokeText("Hello",30,40);
context.fillText("World",30,50);