我從Chrome中recieving的錯誤是: Uncaught TypeError: Cannot read property 'position' of undefined
我不明白爲什麼我不能訪問該路徑的位置字段,因爲它是在文檔中明確規定:http://paperjs.org/reference/path/#position
這裏是我的簡單的代碼:爲什麼我的路徑位置在paper.js中未定義?
paper.install(window);
var canvas = document.getElementById("letterCanvas");
window.onload = function()
{
paper.setup("letterCanvas");
function Game(width, height)
{
this.width = width;
this.height = height;
this.tps = 60;
this.test = new Path.Rectangle(new Point(100,100), [50,100]);
this.test.strokeColor = "black";
}
Game.prototype.tick = function()
{
this.test.position = this.test.position.add(5,5);
}
function Activity(game)
{
}
view.onFrame = function()
{
game.test.rotate(3);
}
var game = new Game(988,644);
__intervalId = window.setInterval(game.tick,1000/game.tps);
view.draw();
}
如果您有一個託管在某處的示例,那麼我們就可以訪問所有代碼(包括紙張等) –