开发者

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

开发者 https://www.devze.com 2022-12-22 03:54 出处:网络
What scripti开发者_如何转开发ng languages can be used with the HTML5 canvas element?This question may really come down to \"what scripting languages are commonly supported by browsers?\"

What scripti开发者_如何转开发ng 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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消