canvas vs. webGL vs. CSS 3d ->选择哪个? [英] canvas vs. webGL vs. CSS 3d -> which to choose?

查看:31
本文介绍了canvas vs. webGL vs. CSS 3d ->选择哪个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于基本的 3d 网络应用程序,即在 3d 空间中的几个立方体、旋转和平移 - 选择哪个更好?

For basic 3d web application i.e. a few cubes, rotation and translation in 3d space - which is better to choose?

CSS 3d 看起来最简单,但在 IE9 或 IE10 的路线图上不受支持,并且提供的控制比其他选项少.帆布&WebGL 似乎要复杂得多,但我不知道它们是否是面向未来的.

CSS 3d seems the easiest, but is not supported on IE9 or on the roadmap for IE10, and offers less control than the other options. Canvas & WebGL seems way more complicated, but I don't know if they are future proof.

为什么 3D 有这么多不同的技术?哪个更好?这是未来的证明?

Why are there so many different techniques for 3D? which is better? which is future proof?

推荐答案

3D 之所以有这么多不同的选择,是因为整个事情仍然处于不断变化的状态——浏览器中的 3D 还没有完成在您列出的选项中,唯一适用于所有当前可用浏览器的选项是 Canvas.

The reason there are so many different options for 3D is because the whole thing is still in a state of flux -- 3D in the browser isn't a finished standard, and of the options you listed, the only one that works in all currently available browsers is Canvas.

特别是 IE 不太可能给您带来太多乐趣——正如您所说,此时 3D 甚至不适合 IE10.话虽如此,SVG 很晚才被添加到 IE9 中,所以总是有希望的.但不太可能的原因是 Microsoft 已明确表示只支持已正式批准为标准的功能.

IE in particular is unlikely to give you much joy -- as you say, 3D isn't even slated for IE10 at this point. Having said that, SVG was added to IE9 quite late in the day, so there's always hope. But the reason it's unlikely is that Microsoft have made a point of only supporting features which have been formally ratified as standards.

在您列出的技术中,Canvas 是迄今为止最受支持的技术,但 Canvas 不是 3D 技术;它是一个 2D 画布,如果您想在其中添加 3D 效果,您需要自己编写它们,并且它们不会被硬件加速.

Of the technologies you listed, Canvas is by far the best supported, but Canvas isn't a 3D technology; it's a 2D canvas, and if you want to have 3D effects in it, you need to write them yourself, and they won't be hardware accelerated.

我想您问题的真正答案取决于该功能对您网站的重要性.如果它只是眼睛糖果,不受支持的浏览器的用户可以没有它,那么一定要使用一些 3D CSS.但是如果你需要让它在当前所有浏览器中保持一致,那就用 Canvas 来做.

I guess the real answer to your question depends on how important the feature is for your site. If it's just eye candy, which users of unsupported browsers could live without, then by all means do it with some 3D CSS. But if you need to make it consistent in all current browsers, then do it with Canvas.

我倾向于建议不要在您的情况下使用 WebGL,因为这听起来对您正在做的事情来说太过分了.

I'd tend to recommend not using WebGL for your case, because it sounds like it would be overkill for what you're doing.

3D CSS 可能是正确的答案,但现在使用 Canvas,直到其他浏览器添加对 3D CSS 的支持.

3D CSS is probably the right answer, but use Canvas for now, until the rest of the browsers add support for 3D CSS.

这篇关于canvas vs. webGL vs. CSS 3d ->选择哪个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆