Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个Rect分配给变量 myrect:
Rect
var myrect = new Rect (250,0,20,200);
我以为这样写:
console.log(myrect.x);
会输出 250 但是,它说“未定义”。
我想知道如何通过对它的 x 和 y 坐标执行算术来重绘这个矩形。
访问 x 和 y 属性的方法是通过attr()方法。
attr()
console.log(myrect.attr('x'));
在文档中查看。但我不得不承认,文档对初学者还不是很友好。