在Firefox中优化SVG viewBox动画(Optimizing SVG viewBox Animation in Firefox)

编程入门 行业动态 更新时间:2024-10-23 21:37:06
在Firefox中优化SVG viewBox动画(Optimizing SVG viewBox Animation in Firefox)

我正在开发一个javascript图表库,我为此选择了svg 。 随时更改viewBox以允许用户查看图表的所有部分至关重要。

我使用snap.svg为我的viewBox属性设置动画,它在某种程度上是平滑但不令人满意的。

我想知道是否有其他技术来改进svg重新渲染,比如使用GPU或其他东西?

https://jsfiddle.net/omidh/uwc0y524/1/

当所有viewBox属性一次更改时,大多数都是缓慢的,无论如何要改进这一点? 我的svg只包含<line>和<circle>

编辑:它在chrome中比firefox更加流畅,所以chrome很好。

编辑:即使Internet Explorer也比firefox好

I'm developing a javascript chart library, I chose svg for this purpose. It's crucial to change viewBox time to time to allow users to see all parts of the chart.

I used snap.svg for animating my viewBox attribute and it's somehow smooth but not satisfying.

I wonder is there other techniques to improve svg re-rendering, like using GPU or something?

https://jsfiddle.net/omidh/uwc0y524/1/

Most sluggish when all viewBox Attributes are changed at once, anyway to improve this? My svg only contains <line> and <circle>

Edit: It's much more smooth in chrome than firefox, so chrome is fine.

Edit: Even Internet Explorer is better than firefox

最满意答案

问题不是动画方法,而是Firefox中的svg Render性能。

以前我在svg中使用了两个<line>每个“x”形状,所以为了减少对象计数,我把它改成一个<polyline> ,这给了我10% - 20%的渲染速度提升。

The problem is not the Animation method but svg Render performance in Firefox.

Previously I used two <line> per "x" shape in my svg, So to reduce object counts I changed it to one <polyline> which gave me 10% - 20% rendering speed boost.

更多推荐

本文发布于:2023-08-01 02:55:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1352887.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:动画   SVG   Firefox   viewBox   Animation

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!