哪个更好,为什么? RaphaelJS 还是 HTML5 Canvas?
我在网上找到了一个矢量库,甚至可以在 IE6 上使用!
http://raphaeljs.com/index.html
太棒了。
现在我的问题是它比即将推出的 HTML5
甚至还需要更长的时间,直到互联网上的所有 IE 用户都摆脱他们的旧浏览器,这样我们才能证明使用 HTML5
我一直致力于遵守标准,但由于微软浏览器的缓慢开发,这一标准将花费太长的时间。
想法?
I found a vector library on the Internet that even works with IE6!
http://raphaeljs.com/index.html
It's amazing.
Now my question is it better than the upcoming HTML5 <canvas>? The only reason I ask is that it could be years before Microsoft implements a <canvas> that doesn't require a plugin for it to run.
And it will be even longer until all the IE users on the Internet get rid of their old browsers so that we can even justify using the HTML5 <canvas>.
I'm all about sticking to standards, but this one is just going to take too long, thanks to MS's slow development of their browser.
Thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Raphael 是一个矢量图形库,使用 SVG 完成,而 HTML5 canvas 是位图图形。
如果你想做矢量图形,我认为使用 Raphael 可能比“只是”画布是一个不错的选择。正如你所说,canvas 不太适合 IE,可能还需要一段时间才能得到原生支持。如果 Raphael 满足了您的需要,就没有特别的理由不使用它。
请注意,还有其他库可以实现此目的:Excanvas,它使用 VML 模拟 IE 的画布(据我所知),还有其他一些库可以对 Silverlight 和 Flash 执行相同的操作,但我忘记了它们的名称。
还有 Dojo,它有一个组件,用于在易于使用的界面后面抽象画布的使用,它也支持 IE。
在所有浏览器中拥有本机画布不会使库过时,因为库通常会抽象一些画布复杂性,从而使使用更容易。
Raphael is a vector graphics library, done using SVG, whereas HTML5 canvas is bitmap graphics.
If you want to do vector graphics, I think going with Raphael is probably a good choice over "just" canvas. As you say, canvas does not quite work with IE and it will probably be a while before it's natively supported. If Raphael does what you need, there is no particular reason not to use it.
Do note that there are also other libraries for this: Excanvas, which emulates canvas for IE using VML (as far as I know), and also some others which do the same with Silverlight and Flash but I forgot their names.
There's also Dojo, which has a component for abstracting canvas usage behind an easy to use interface, which also supports IE.
Having native canvas in all browsers will not make the libraries obsolete, since the libraries usually abstract some of the canvas complexities away, making the usage easier.
Google 的 SVGWeb (http://code.google.com/p/svgweb/) 是你想要什么。它使 IE 与 SVG 兼容,这是标准,并且所有其他主流浏览器都已支持。换句话说,正如 google 所说,“使用该库加上本机 SVG 支持,您可以立即定位现有已安装网络库的约 95%。”
SVGWeb (http://code.google.com/p/svgweb/) by Google is what you want. It makes IE compatible with SVG, which is the standard, and which all other mainstream browsers already support. In other words, as google say, "Using the library plus native SVG support you can instantly target ~95% of the existing installed web base."
您可以使用 http://code.google.com/p/explorercanvas/ 来实现IE 中的 HTML5 Canvas 标准。你要做的就是添加:
Canvas 和 SVG 之间的区别解释如下:
And you can use http://code.google.com/p/explorercanvas/ which implements the HTML5 Canvas Standard in IE. All you do is add:
The difference between Canvas and SVG is explained as follows:
答案取决于您的需要:
如果您需要向图形对象添加事件处理程序:您需要使用 SVG。 Else Canvas。
如果不需要事件,则性能很重要:如果是,则使用 Canvas 5。
请注意,IE 9 支持 Canvas,并提供更多 HTML 5 支持到其他浏览器!
The answer depends on what you need:
if you need to add event handlers to the graphic objects: you need to use SVG. Else Canvas.
if no events are needed is performance important: if yes then Canvas 5.
Note that IE 9 supports Canvas and offers more HTML 5 support compare to other browsers!