我有一个阶段,尺寸800x600像这样初始化
stage = new Kinetic.Stage({
width:800,
height:600,
container:'container'
});
然后我像这样初始化一个backgroundLayer
backgroundLayer = new Kinetic.Layer({
width:800,
height:600,
visible:true,
draggable:true,
});
和像这样的Image对象
imageObj = new Image()
image.src = "../path/to/image/"
imageObj.onload = function (){
backgroundImage = new Kinetic.Image({
image:imageObj,
width:800,
height:600,
offset: {x: 400, y:300}
});
backgroundLayer.add(backgroundImage);
}
我正在将图像添加到backgroundLayer并将图层添加到舞台
stage.add(backgroundLayer);
使用这样的偏移设置会使图像仅出现在舞台的上角,并且必须拖动才能看到它。如果我旋转图像,前一个图像仍然存在(未旋转),直到我拖动它。所以我的问题是:
一如既往地提前感谢!
编辑:如果我执行stage.draw()并且不在图层或图像上调用draw()方法,则图像会从后面消失。对于其他人,我仍然没有线索。