To Examples

Canvas Example

Source code file: Canvas/app/assets/javascripts/drawing.js:

draw = function( ) {
   c = document.getElementById("myCanvas");
   ctx = c.getContext("2d");
   ctx.fillStyle = "#FF0000";
   ctx.fillRect(20,50,150,75);
   ctx.beginPath( );
   ctx.arc(95, 50, 40, 0, 2 * Math.PI);
   ctx.stroke( );
   ctx.font = "20px Arial";
   ctx.fillText("JavaScript Art", 150, 20);
}