Canvas Element - Example

Example

The following code creates a Canvas element in an HTML page:

This text is displayed if your browser does not support HTML5 Canvas.

Using JavaScript, you can draw on the canvas:

var example = document.getElementById('example'); var context = example.getContext('2d'); context.fillStyle = 'red'; context.fillRect(30, 30, 50, 50);

This code draws a red rectangle on the screen.

Read more about this topic:  Canvas Element

Famous quotes containing the word example:

    Our intellect is not the most subtle, the most powerful, the most appropriate, instrument for revealing the truth. It is life that, little by little, example by example, permits us to see that what is most important to our heart, or to our mind, is learned not by reasoning but through other agencies. Then it is that the intellect, observing their superiority, abdicates its control to them upon reasoned grounds and agrees to become their collaborator and lackey.
    Marcel Proust (1871–1922)