views:

341

answers:

2

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?

+7  A: 

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.

Jonas
The world has spoken: Applets are not an alternative.
Justin Johnson
+2  A: 

You can use languages that compile to JavaScript:

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.

Daniel Cassidy