创建基于画布的UI组件有意义吗? [英] Does it make sense to create canvas-based UI components?

查看:168
本文介绍了创建基于画布的UI组件有意义吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然DOM仍然完全支配我们创建UI的方式,但是创建一堆完全基于画布的UI组件(如按钮,列表,水平/垂直组等)是否有意义呢?

While DOM still totally dominates the way we create UIs, does it make sense to create a bunch of entirely canvas-based UI components, like buttons, lists, horizontal/vertical groups, etc?

我知道肯定会有很多缺点,但是这样的可能的优点是什么呢?

I know for sure that there will be a lot of drawbacks, but what would the possible advantages of such be?

对于一个,我想说通常与canvas的视觉整合将会更紧。

For one, I'd say in general the visual integration with canvas will be much tighter.

推荐答案

否。

还记得早期的2000年代?当每个人都认为使用Flash发明最可恶的网站导航的竞赛会很酷吗?

Remember the early 2000's? When everyone thought it would be cool to have a race to invent the most nauseating website navigation possible using Flash?

让我们不要这样做。

有一些 UI元素可以通过canvas来预处理,但是请记住,这些元素不会被网页抓取工具(如Google)或用户访问谁有脚本禁用等。

It is okay to have some UI elements that are prettified by canvas, but remember that these elements won't be accessible to web crawlers (like Google), or to users who have scripts disabled, etc.

还值得注意的是,HTML Canvas Spec有一个部分,他们强烈建议不要在Canvas中创建文本编辑控件。 / p>

It is also worth noting that the HTML Canvas Spec has a section where they strongly advise against trying to create text-editing controls in Canvas.


我知道肯定会有很多缺点,但这样做的可能优点是什么?

I know for sure that there will be a lot of drawbacks, but what would the possible advantages of such be?

有很多漂亮的元素,你可以添加到一个页面与Canvas。有些东西可以得到真正美丽的,没有侵入或以任何方式改变页面导航。也许一个网站的标志会增长的程序性或发光或以其他方式变得更复杂。

There are a lot of pretty elements you can add to a page with Canvas. Some things can get really beautiful without being intrusive or altering the page navigation in any way. Perhaps the logo of a website would "grow" procedurally or glow or otherwise get more complex. Other background animation effects might be really neat.

其他背景动画效果可能非常整齐。还有交互式图像,如在您想要一个图表或分解视图的网站上,您将导航到检查某物(化学结构,生物有机体,新车)的各种部分。视觉交互式媒体(如图表和游戏)是Canvas的一些最佳用例。

There are also interactive images, like on sites where you want a diagram or breakdown or exploded view that you would navigate to inspect the various parts of something (a chemical structure, a biological organism, a new car). Visual interactive media such as diagramming and games are some of the best use-cases for Canvas.

在强调页面的UI方面,页面也应该工作

In terms of accenting the UI of the page, the page ought to also work perfectly if the Canvas elements of it were not there.

但是要替换按钮吗?替换文本字段?替换列表?绝对不。这些应该不是Canvas的域名。

But replace buttons? Replace text fields? Replace lists? Absolutely not. Those should never be the domain of Canvas.

这篇关于创建基于画布的UI组件有意义吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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