Use the Code: WRAC11
I keep trying to write this post but just can’t get a solid start. So stick with me, no matter what, I am posting something.
HTML 5 only supports one kind of shape: rectangle. To draw other shapes you need to use paths like an arc.
Let’s draw a rectangle and a circle on a canvas, a very simple JavaScript function:
This is a very simple example, when the page loads the function runs, normally you would have the javascript function placed somewhere else in the page.
The image in this blog is what you can see. You might want to try changing the circle with the rectangle and see what happens.
Also a word of caution, a number of tutorials, especially those on the mozillia pages have code that simply detects that IE 9 is running and throw up an alert to switch to safari or Firefox, as you can see IE 9 supports HTML 5 quite nicely. Not saying that the tutorials out there are trying to make IE 9 look back, but I am not sure why they throw up the alert.
If you move the circle ahead of the rectangle it will be drawn on top of the rectangle.
Make sure to check out: http://weblogs.asp.net/dwahlin/archive/2011/05/06/getting-started-with-the-html-5-canvas.aspx for more indepth discussions about HTML 5.
great post ! thanks
Thank Sanaulah, I see you are very active in the forums, this is indeed a nice compliment.
Nice!
Shinyo.her,
Thank you for the "Nice!" comment, wish you would say more.
Feel free to leave a link to your online presence (and anyone else who isn't a spammer)
This is a free for all kind of blog although I realize that I can be a little harsh sometimes.
If you have a project, etc. post the link!