简体   繁体   English

Coffescript html5画布库

[英]Coffescript html5 canvas library

What is the best CoffeeScript canvas library available? 什么是最好的CoffeeScript画布库? I have found a topic descibing Javascript libraries (like paper.js, fabric.js or kinetic.js) but they are all written in JavasScript and theoretically could be used with CoffeeScript but practically it could be hard. 我找到了一个描述Javascript库的主题 (如paper.js,fabric.js或kinetic.js),但它们都是用JavasScript编写的,理论上可以和CoffeeScript一起使用,但实际上它可能很难。

So is there any advanced canvas library written in "pure" CoffeeScript, or is it suitable and easy to use one of those available for JavaScript? 那么有没有用“纯”CoffeeScript编写的高级画布库,或者它是否适合并且易于使用其中一种可用于JavaScript?

Actually, using coffeescript with javascript libraries is not hard. 实际上,使用带有javascript库的coffeescript并不难。 The best libraries will always be in javascript, as this is the most compatible format. 最好的库将始终使用javascript,因为这是最兼容的格式。

Personally, I write in coffeescript, and then include the javascript libraries normally. 就个人而言,我用coffeescript编写,然后通常包含javascript库。 When I have examples or code snippets in javascript, I convert them at http://js2coffee.org . 当我在javascript中有示例或代码片段时,我将它们转换为http://js2coffee.org Theoretically you could convert the libraries over, but there is no need for this. 从理论上讲,你可以将库转换过来,但不需要这样做。

I keep my coffeescript in a separate folder, and then use a script to easily compile them for testing - on OSX, the script looks something like: 我将我的coffeescript保存在一个单独的文件夹中,然后使用脚本轻松编译它们以进行测试 - 在OSX上,脚本看起来像:

#!/bin/sh
export PATH=/usr/local/bin
export NODE_PATH=usr/local/lib/node_modules
/usr/local/bin/coffee --compile --output ../media/js/ ../coffee/*.coffee

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM