Invented by Apple for Safari
Procedural graphics (as opposed to SVG's declarative graphics)
<html><head>
<title>canvas</title>
<script type="text/javascript">
function draw() {
var canvas = document.getElementById('tutorial');
if (canvas.getContext){
var context = canvas.getContext('2d');
context.fillRect(25, 25, 150, 150);
context.clearRect(45, 45, 90, 90);
context.strokeRect(50, 50, 50, 50);
}
}
</script>
</head>
<body onload="draw()">
<canvas style="border: 1px solid black;"
id="tutorial"
width="150" height="150"></canvas>
</body>
</html>
View in Browser