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

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

问题描述

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



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



对于一个,我一般会说,与canvas的视觉集成将会更加紧密。

解决方案

否。



记得2000年代初吗?每个人都认为使用Flash发明最恶心的网站导航可能会很酷?



我们再不这样做。



可以通过画布来优化一些 UI元素,但请记住,网页抓取工具(如Google)或用户无法访问这些元素谁有脚本禁用等。



还有值得注意的是,HTML Canvas Spec有一个部分,他们 / p>


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


有很多漂亮的元素可以添加到带有Canvas的页面。有些事情可以非常美丽,而不会以任何方式侵入或改变页面导航。网站的标志也许会在程序上发展或发光,否则会变得更加复杂。其他背景动画效果可能非常整齐。



还有交互式图像,如在您想要的图表或细分或分解视图的网站上,您将浏览以检查各种各样的东西(化学结构,生物体,新车)。视觉互动媒体如图表和游戏是Canvas的一些最佳用例。



在重写页面的UI方面,页面也应该工作完美如果Canvas元素不在那里。



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


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?

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

解决方案

No.

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?

Let's not do that again.

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.

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?

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.

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.

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.

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

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

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