我的遊戲中有以下圈子。玩家將他們拖到遊戲中的不同位置。當玩家選擇,再次玩時,我希望形狀回到init函數中陳述的原始位置。我應該怎麼做呢?謝謝。用KineticJS重置爲默認位置
stage = new Kinetic.Stage({
container: "container",
width: 900,
height: 550
});
shapes = new Kinetic.Layer();
function init() {
circle1 = new Kinetic.Circle({
x: stage.getWidth()/3.2,
y: stage.getHeight()/3.2,
radius: radius,
fill: "blue",
stroke: "black",
strokeWidth: 4,
name: "circle",
draggable: true
});
shapes.add(circle1)
stage.add(shapes)