【问题标题】:Kinetic JS performance issue in Chrome & OperaChrome 和 Opera 中的 Kinetic JS 性能问题
【发布时间】:2013-02-16 23:07:00
【问题描述】:

当我使用 Chrome 或 Opera 浏览器时,我的 kinetic JS 应用程序出现了一些严重的性能问题。当我使用 IE 或 Firefox 时,性能很好。你可以在这里看到应用程序http://kinlibtst.elitno.net/ 这里的js代码:http://kinlibtst.elitno.net/new.js

我现在正在使用免费托管,这可能是原因吗?也许是糟糕的主机解析器?

【问题讨论】:

  • 我认为这只是因为您的页面上有大量数据。有很多图片供浏览器解析。

标签: html performance browser canvas kineticjs


【解决方案1】:

这是一个小问题,你有很多这样的事情:

 cont_venes_sel.on('mouseout', function() {
      document.body.style.cursor = "default";
      this.transitionTo({  // <--- this is a small problem, not a big one
        opacity: 0,
        duration: 0.3
      })
      stage.draw();   //  <---- this is the big problem
    });

问题是,你为什么要重绘整个舞台?
试试这个:

   cont_venes_sel.on('mouseout', function() {
      document.body.style.cursor = "default";
      this.setOpacity(0);  // <--- much less memory required, less intense
      this.getParent().draw();   //  <---- this way you only redraw the layer
    });

【讨论】:

    猜你喜欢
    • 2012-05-10
    • 1970-01-01
    • 2016-03-26
    • 2014-04-29
    • 2013-08-01
    • 1970-01-01
    • 2016-11-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多