HTML 5 introduced support for a canvas element that can be programmatically drawn on. The really nice thing is that it is very similar to drawing using Processing (in fact, Processing's JavaScript mode relies heavily upon the canvas element).
<canvas width="600" height="600" id="mycanvas" /> <script type="text/javascript"> var canvas = document.getElementById('mycanvas'); var context = canvas.getContext('2d'); context.fillStyle="#FF0000"; context.fillRect(0,0,canvas.width,canvas.height); </script>
Example: Canvas with a "draw" loop (Uses JavaScript setInterval)
Example: Canvas with a "draw" loop (Uses requestAnimationFrame)
Example: Canvas with "draw" loop and mouse interaction
Reference: W3 Schools - HTML5 Canvas and W3 Schools - HTML Canvas Reference
Tutorial: Mozilla Developer Network - Canvas Tutorial
Examples: 21 Ridiculously Impressive HTML5 Canvas Experiments