哪个更好,为什么? RaphaelJS 还是 HTML5 Canvas?

发布于 2024-08-04 15:13:03 字数 403 浏览 9 评论 0原文

我在网上找到了一个矢量库,甚至可以在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

你没皮卡萌 2024-08-11 15:13:03

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.

雨后咖啡店 2024-08-11 15:13:03

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."

浅浅 2024-08-11 15:13:03

您可以使用 http://code.google.com/p/explorercanvas/ 来实现IE 中的 HTML5 Canvas 标准。你要做的就是添加:

<head>
<!--[if IE]><script src="excanvas.js"></script><![endif]-->
</head>

Canvas 和 SVG 之间的区别解释如下:

SVG 和 canvas 并不是真正的
可互换的技术。 SVG 是一个
保留模式图形的类型,其中
一切都是从一个相当
抽象模型(SVG 文档)。
另一方面,画布是一种
立即模式图形,那里有
没有模特和客户
(JavaScript)必须照顾
重画、动画等。

And you can use http://code.google.com/p/explorercanvas/ which implements the HTML5 Canvas Standard in IE. All you do is add:

<head>
<!--[if IE]><script src="excanvas.js"></script><![endif]-->
</head>

The difference between Canvas and SVG is explained as follows:

SVG and canvas aren't really
interchangeable technologies. SVG is a
type of retained mode graphics where
everything is drawn from a rather
abstract model (the SVG document).
Canvas on the other hand is a kind of
immediate mode graphics, where there
is no model and the client
(JavaScript) must take care of
redrawing, animations etc.

熊抱啵儿 2024-08-11 15:13:03

答案取决于您的需要:

  • 如果您需要向图形对象添加事件处理程序:您需要使用 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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文