简体   繁体   English

Web应用程序性能:SVG,画布或Dom操作

[英]Web App Performance: SVG, Canvas, or Dom Manipulation

I'm working on an application that will display a 'boxes and arrows' diagram similar to a Visio. 我正在开发一个显示类似于Visio的“框和箭头”图的应用程序。 Some elements are drag and drop-able. 有些元素是可拖放的。 Key features are opacity, angled connecting lines, and some animated transitions. 关键功能是不透明度,倾斜的连接线以及一些动画过渡。

Target platforms are webkit browsers, iOS tablets, and android tablets. 目标平台是webkit浏览器,iOS平板电脑和android平板电脑。

(I see this question, but the links I saw do not give a high level performance comparison of the two Canvas versus SVG animations (effects[filters] and performance) ) (我看到了这个问题,但是我看到的链接没有对两个Canvas和SVG动画(effects [filters]和performance)进行高层性能比较

What web technology will give me the best performance for this kind of rendering and manipulation? 哪种网络技术可以为我提供这种渲染和操作的最佳性能? Canvas drawing, SVG, or div/Dom manipulation? 画布绘制,SVG或div / Dom操作?

Canvas : gives you complete control over everything. 画布 :让您完全掌控一切。 You can define your shapes and text and other widgets yourself. 您可以自己定义形状和文本以及其他小部件。 You have pixel level control. 您具有像素级控制。

SVG : gives you a large array of shapes and effects to use. SVG :为您提供多种形状和效果供使用。 SVG is in XML, which-- excuse my personal bias-- I love the most about it. SVG使用XML,这是我个人最喜欢的,这是我个人的偏见。

DOM : probably the trickiest to use because you have to fight with cross-browser compatibly issues, but the trade off is that it's easy to express effects with CSS and animations or other logic with JavaScript. DOM :可能是最难使用的,因为您必须与跨浏览器兼容的问题作斗争,但是要权衡的是,很容易用CSS和动画来表达效果,或者用JavaScript来表达其他逻辑。

Performance? 性能? Not really sure. 不太确定。 Your target platform range is quite wide. 您的目标平台范围很广。 You'll just have to do a little empirical or benchmark testing. 您只需要进行一些经验或基准测试。

Canvas will probably get you the fastest performance if you use common shortcuts like stacking canvases or drawing off-screen, among others. 如果您使用常见的快捷方式,例如堆叠画布或在屏幕外绘图,则Canvas可能会为您带来最快的性能。

All my opinion, of course. 我所有的意见,当然。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM