Hemme's Blog

Stories from behind the keyboard

  • RSS
  • Twitter
  • Linkedin

Well, this is sort of an implicit tutorial about HTML5 and the <canvas/> tag. If your browser supports HTML5 (*) you'll see an animated starfield: just click and move your mouse (sort of... read the asterisk *) to enjoy a romantic.. er... a classic animation. The javascript code is neither minified nor obfuscated, soo feel free to invastigate the source code of this page.

Happy programming!

(Yes... I told I would continue my previous post about fractals and razor... I promise I will do it, soon.)

Sorry, your browser is too old to support canvas!

(*) …and if you are not using Mozilla, which fires a subtle NS_ERROR_DOM_SYNTAX_ERR. As of now FireFox is in troubles if someone (i.e. some code) wants to draw something outside the boundary of a canvas. The roundtrip described here by rogerh requires you to create a temporary canvas, do all the operations in this canvas and write back to the original one. I decided not to implement this roundtrip in this demo, so the viewport rotation and the mouse interactivity are only available to Internet Explorer and Chrome.

No comments: