HTML/Javascript Canvas Triangles Game Tutorial

HTML/Javascript Canvas Chalkboard Game Tutorial

HTML/Javascript Canvas Triangles Game Tutorial

The Canvas HTML element tag can be used as the container to draw graphics on the fly usually via the use of Javascript functions for rendering and event management.

In today’s tutorial we touch on the functionality to draw an image on the canvas via drawImage() method and draw some text via strokeText() method. In the case of this tutorial that image and text contributes to the user answering some mathematics trigonometry questions regarding Triangles on a simulated “chalkboard”.

You may want to read more at HTML Canvas Reference as a generic reference, or here, at the tutorial javascript – How do I add a simple onClick event handler to a canvas element? – Stack Overflow.

As you can imagine, this HTML canvas element, new to HTML5, can be very useful for some practical client-side web functionality.

Link to some downloadable HTML programming code … rename to triangle_chalkboard.html

You’ll notice heavy use of the Javascript Math.random() function.

We hope you enjoy this tutorial as a live run.

Did you know?

This version of Paintbrush (albeit on a Mac, and so not the original Windows application from eons back) is good enough to be able to do transparent “painting” with the paintcan icon (as used for this tutorial). To my mind that makes Paintbrush a serious contender for “underappreciated” application of the 4th dimension (of onions … “you had to be there“). Maybe even dimension 5 3/4!

Yes … you’ve reached the end … hope you have a good time practising your mathematical trigonometry knowledge of Triangles (there is advice, if you want to learn … you can get it when you give an incorrect answer)!

If this was interesting you may be interested in this too.

This entry was posted in eLearning, Event-Driven Programming, Games, GUI, Tutorials and tagged , , , , , , , , , . Bookmark the permalink.

6 Responses to HTML/Javascript Canvas Triangles Game Tutorial

  1. Invincible says:

    Hello.This post was extremely fascinating, especially since I was looking for thoughts on this matter last couple of days.

  2. Hi every one, here every person is sharing these knowledge, therefore it’s pleasant to read this web site, and I used to go to see this blog everyday.|

  3. F*ckin’ tremendous things here. I am very glad to see your article. Thanks a lot and i’m looking forward to touch you. Will you please drop me a mail?

  4. Carl Ave says:

    I have recently started a website, the information you provide on this site has helped me tremendously. Thank you for all of your time & work. “‘Tis our true policy to steer clear of permanent alliances with any portion of the foreign world.” by George Washington.

  5. Leia Paris says:

    Some genuinely choice posts on this web site , bookmarked .

  6. You are my inhalation , I have few blogs and sometimes run out from to post .

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>