![]() Capt. Horatio T.P. Webb |
Parks -- Spring 2014 Version 5 -- 7/18/2014 |
<canvas id="id for this canvas" width="pixel width" height="pixel height"></canvas>
Then aLL the canvas methods use "david" as the canvas context name:
david.any_canvas_method
You can also control some attributes of the canvas by getting or setting the CSS style properties of the of the canvas (i.e.,
<canvas id="canvas1" width="400" height="60" style="border:solid blue 1px;">This broswer does NOT support CANVAS</canvas>
Below are the detailed CANVAS functions and some examples:
Click here for HTML5 video Example
Click here for the new HTML5 input types
Click here for HTML5 range (slider) discussion
The above are for use with opacity transparency with images. See the Color section above for more general opacity and color issues.
var name_for_the_canvas_object = document.getElementById("id for this canvas");
var name_for_the_canvas_context = name_for_the_canvas_object.getContext("2d");
If the "id" of the canvas is for example "fred" (i.e., < canvas id="fred"...), then in the javascript you could say:
var david = alice.getContext("2d");
document.getElementById("id for this canvas").style.css_property.value
Here is the HTML canvas for a 100 x 50 blue bordered canvas:
With Equations
The best HTML control addition to HTML in a decade.