Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What scripting languages can be used with the HTML5 canvas element?

What scripting languages can be used with the HTML5 canvas element? This question may really come down to "what scripting languages are commonly supported by browsers?"

Nearly all of the HTML5 canvas examples/tutorials use JavaScript. Some use processing, but even those fall back to Processing.js to do the rendering. Are there any good alternatives to JavaScript for interactive animation in a canvas?

like image 408
Brian Avatar asked Mar 02 '10 18:03

Brian


2 Answers

Yes, when it comes to the canvas tag, it's all about JavaScript. Read more at http://en.wikipedia.org/wiki/Canvas_element

No, there are no alternatives if you want to use the <canvas> tag. JavaScript is the only language that is widely supported in web browsers without plugins.

If you want alternatives, you cannot use <canvas>. Two alternatives for custom painting in browsers are ActionScript/Flash (requires Flash plugin) and Java Applets or JavaFX/JavaFX Script.

like image 65
Jonas Avatar answered Jan 09 '23 03:01

Jonas


You can use languages that compile to JavaScript:

  • Java (via GWT)
  • Haxe
  • CoffeeScript
  • Kaffeine

Note that GWT adds a lot of bulk to your page and I’m not sure it’s really such a great idea in any case.

Haxe always includes its standard library in JavaScript output, so it adds a little bulk to the page.

CoffeeScript and Kaffeine are very thin layers over JavaScript, and don’t add any extra bulk to your page other than your code. The JavaScript output by CoffeeScript is often significantly shorter than it would have been had you written the JavaScript by hand.

You will certainly need to know JavaScript to debug your code, no matter what language you write in.

like image 34
Daniel Cassidy Avatar answered Jan 09 '23 05:01

Daniel Cassidy