2013-03-02 72 views
2

當我使用Chrome或Opera瀏覽器時,我的kinetic JS應用程序出現了一些性能問題。當我使用IE或Firefox時,性能很好。你可以看到應用程式中http://kinlibtst.elitno.net/ JS代碼在這裏:http://kinlibtst.elitno.net/new.jsChrome&Opera中的Kinetic JS性能問題

我使用的是免費託管,現在,它可以是什麼原因?也許糟​​糕的主機解析器?

+0

我認爲它只是從你的莖有你的頁面上大量的數據。有很多圖像供瀏覽器解析。 – SoluableNonagon 2013-03-02 22:50:35

回答

2

這裏是一個小問題,你有很多事情是這樣的:

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 
    }); 
+0

我希望我能兩次投票... – 2014-06-02 06:59:35