0
我用kineticjs畫了兩個圓, 我想對稱地改變第一個圓的dragmove上的圓的位置,這是我的代碼。在dragmove上對稱地改變圓的位置kineticjs的另一個圓
newArc = new Kinetic.Circle({
x: mouse.x,
y: mouse.y,
radius: .25,
fill: Color,
stroke: "lightgray",
strokeWidth: 3,
draggable: true
});
layer.add(newArc);
newArcMir = new Kinetic.Circle({
x: stage.getWidth()-mouse.x,
y: mouse.y,
radius: .25,
fill: Color,
stroke: "lightgray",
strokeWidth: 3,
draggable: true
});
newArc.on('dragmove', function() {
newArcMir.setX(stage.getWidth()-this.getX());
newArcMir.setY(this.getY());
});
newArcMir.on('dragmove', function() {
newArc.setX(stage.getWidth()-this.getX());
newArc.setY(this.getY());
});
我得到一個錯誤「遺漏的類型錯誤:無法讀取屬性‘中與此相關的行
newArcMir.setX(stage.getWidth()-this.getX());
你可以做任何jsfidle演示? – lavrton
這是jsfidle演示http://jsfiddle.net/D2vbd/ –
你演示不工作,我的意思是它壞了。 – lavrton