Drawing on browser canvas with JavaScript
var canvas = document.getElementById("canvas"); canvas.width = canvas.width var ctx = canvas.getContext("2d"); ctx.fillStyle = "rgb(200,0,0)"; ctx.fillRect(130, 130, 50, 50); ctx.fillStyle = "rgba(0, 0, 200, 0.1)"; for (i = 1; i<=100; i++) { ctx.fillRect(Math.round(Math.random()*300), Math.round(Math.random()*300), 50, 50); }
Read the
description of how this was done
.