我想知道你們是否可以幫我解決我遇到的問題。希望確定問題不會要求您查看我正在使用的圖形軟件包的文檔,但是如果確實如此,那麼您可以:http://raphaeljs.com/reference.html#Element.transform。JavaScript函數在我第一次打電話時才工作?
我的代碼
window.setInterval(function()
{
mycirc.transform("t1,1");
}, 500);
以下塊,這當然應該調用函數mycirc.transform("t1,1")
每半秒。該函數應該將每個單元的x和y座標分別翻譯爲mycirc
(查看http://raphaeljs.com/reference.html#Element.transform上的Element.transform([tstr])。
但是,當我測試我的頁面時,mycirc
被翻譯一次,然後後續調用不起作用。我用console.log(...)
測試,並確保:
window.setInterval(function()
{
var bb = mycirc.getBBox();
console.log("coords before transformation: " + bb.x + "," + bb.y);
mycirc.transform("t1,1");
var bb = mycirc.getBBox();
console.log("coords after transformation: " + bb.x + "," + bb.y);
}, 500);
產生
coords before transformation: 120.98508107696858,106 jsfunctions.js:411
coords after transformation: 121.98508107696858,107 jsfunctions.js:414
coords before transformation: 121.98508107696858,107 jsfunctions.js:411
coords after transformation: 121.98508107696858,107 jsfunctions.js:411
等等。
任何想法,爲什麼這可能是?
(我試圖通過對圖形包中的源代碼看,卻是因爲沒有空格的不可讀。)